/**
  * @param null $path
  * @param ilCloudFileTree|null $file_tree
  * @return mixed
  * @throws \Dropbox\Exception_BadResponseCode
  * @throws \Dropbox\Exception_InvalidAccessToken
  * @throws \Dropbox\Exception_RetryLater
  * @throws \Dropbox\Exception_ServerError
  */
 public function deleteItem($path = null, ilCloudFileTree $file_tree = null)
 {
     $path = ilCloudUtil::joinPaths($file_tree->getRootPath(), $path);
     return $this->getServiceObject()->delete($path);
 }
 /**
  * @param null            $path
  * @param ilCloudFileTree $file_tree
  *
  * @return bool
  */
 public function deleteItem($path = NULL, ilCloudFileTree $file_tree = NULL)
 {
     //		throw new ilCloudException(-1, print_r($file_tree, true));
     $path = ilCloudUtil::joinPaths($file_tree->getRootPath(), $path);
     return $this->getClient()->delete($path);
 }
 /**
  * @param $id
  * @param $folder_name
  * @throws ilCloudException
  */
 public function addFolderToService($id, $folder_name)
 {
     try {
         if ($folder_name == null) {
             throw new ilCloudException(ilCloudException::INVALID_INPUT, $folder_name);
         }
         $current_node = $this->getNodeFromId($id);
         $path = ilCloudUtil::joinPaths($current_node->getPath(), ilCloudUtil::normalizePath($folder_name));
         if ($this->getNodeFromPath($path) != null) {
             throw new ilCloudException(ilCloudException::FOLDER_ALREADY_EXISTING_ON_SERVICE, $folder_name);
         }
         $current_node->setLoadingComplete(false);
         $this->storeFileTreeToSession();
         $service = ilCloudConnector::getServiceClass($this->getServiceName(), $this->getId());
         $service->createFolder($path, $this);
         $this->addItemsFromService($current_node->getId());
         $new_path = ilCloudUtil::joinPaths($current_node->getPath(), $folder_name);
         $new_node = $this->getNodeFromPath($new_path);
         return $new_node;
     } catch (Exception $e) {
         if ($e instanceof ilCloudException) {
             throw $e;
         }
         throw new ilCloudException(ilCloudException::FOLDER_CREATION_FAILED, $e->getMessage());
     }
 }