* Folders method - Admin API * * @property ApiClient $apiClient Defined in AdminApi class. * * @api */ trait FoldersTrait { /** * Lists all root folders. * * @param array $options The optional parameters. See the * Admin API * documentation. * * @return ApiResponse * * @see https://cloudinary.com/documentation/admin_api#get_root_folders */ public function rootFolders($options = []) { $params = ArrayUtils::whitelist($options, ['next_cursor', 'max_results']); return $this->apiClient->get(ApiEndPoint::FOLDERS, $params); } /** * Lists sub-folders. * * Returns the name and path of all the sub-folders of a specified parent folder. Limited to 2000 results. * * @param string $ofFolderPath The parent folder * @param array $options The optional parameters. See the * Admin API documentation. * * @return ApiResponse * * @throws ApiError * * @see https://cloudinary.com/documentation/admin_api#get_subfolders */ public function subFolders($ofFolderPath, $options = []) { $uri = [ApiEndPoint::FOLDERS, $ofFolderPath]; $params = ArrayUtils::whitelist($options, ['next_cursor', 'max_results']); return $this->apiClient->get($uri, $params); } /** * Creates a new empty folder. * * @param string $path The full path of the new folder to create. * * @return ApiResponse * * @throws ApiError * * @see https://cloudinary.com/documentation/admin_api#create_folder */ public function createFolder($path) { $uri = [ApiEndPoint::FOLDERS, $path]; return $this->apiClient->post($uri); } /** * Deletes an empty folder. * * The specified folder cannot contain any assets, but can have empty descendant sub-folders. * * @param string $path The full path of the empty folder to delete. * * @return ApiResponse * * @throws ApiError * * @see https://cloudinary.com/documentation/admin_api#delete_folder */ public function deleteFolder($path) { $uri = [ApiEndPoint::FOLDERS, $path]; return $this->apiClient->delete($uri); } }