<?php

Class VServices {
	
	private $_apiUrl;
	private $_curlObj;
	private $_userId;
	
	public function __construct() {
		
	}
	
	public function setApiUrl($url) {
		$this->_apiUrl = $url;
	}
	
	public function setConnection($curl) {
		$this->_curlObj = $curl;
	}
	
	public function setUserId ($userId) {
		$this->_userId = $userId;
	}
	
	public function getPrivateTree () {
		$this->_curlObj->create($this->_apiUrl. 'space/dir/isgetall/1');
		$this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
		$this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
		
		$post = array('userid' => $this->_userId);
		$this->_curlObj->post($post);
		return $this->_curlObj->execute();
	}
	
	public function createDir ($dirName, $parentId) {
		$this->_curlObj->create($this->_apiUrl. 'space/mkdir');
		$this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
		$this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
		
		$post = array('userid' => $this->_userId, 'parent_id' => $parentId, 'name' => $dirName);
		$this->_curlObj->post($post);
		return $this->_curlObj->execute();
	}
		
	public function __destruct() {
		
	}
}