Instantiate the required library class
$http = new \Romby\Box\Http\Adapters\GuzzleHttpAdapter(new \GuzzleHttp\Client())
$files = new \Romby\Box\Services\Files($http);/* @param int $id the id of the folder.
* @param string $token the OAuth token.
* @return array the file.
*/
$files->get($id, $token)/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @param array $params the parameters to set on the folder.
* @param string|null $version if set, the file will only be updated if this is the latest version.
* @return array the updated file.
*/
$files->update($id, $token, $params, $version = null);To Lock:
/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @param string|null $expires_at the time the lock expires.
* @param string|null $is_download_prevented true if the file should be prevented from download.
* @return array the response.
*/
$files->lock($id, $token, $expires_at = null, $is_download_prevented = null);To Unlock:
/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @return array the response.
*/
$files->unlock($id, $token);/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @param string $name the name to store the file under.
* @param string $version the specific version of the file to download.
* @return void
*/
$files->download($id, $token, $name, $version = null);/* @param string $token the OAuth token.
* @param string $name the name to store the file under.
* @param int $parent the id of the folder containing the file.
* @param int|null $size the size of the file.
* @return array the response.
*/
$files->preflightCheck($token, $name, $parent, $size = null);
/* @param string $token the OAuth token.
* @param string $file the name of the local file to upload.
* @param string $name the name to store the file under.
* @param string $parent the parent folder to store the file in.
* @param string|null $content_created_at the time the file was created.
* @param string|null $content_modified_at the time the file was last modified.
* @return array the uploaded file.
*/
$files->upload($token, $file, $name, $parent, $content_created_at = null, $content_modified_at = null);/* @param int $id the id of the file to delete.
* @param string $token the OAuth token.
* @param string|null $version the version to delete.
* @return void
*/
$files->delete($id, $token, $version = null);/* @param int $id the id of the file to upload a new version of.
* @param string $token the OAuth token.
* @param string $file the local file to upload.
* @param string|null $version the last known version of the file.
* @return array the uploaded file.
*/
$files->uploadVersion($id, $token, $file, $version = null);/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @return array the versions.
*/
$files->getVersions($id, $token);See "Download a File"
/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @param int $version the version of the file.
* @return array the new version.
*/
$files->promoteVersion($id, $token, $version);/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @param int $version the version of the file.
* @return void
*/
$files->deleteVersion($id, $token, $version);/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @param int|null $parent the id of the folder to put the file in.
* @param string $name the new name of the file.
* @return array the new file.
*/
$files->copy($id, $token, $parent, $name = null);/* @param string $token the OAuth token.
* @param int $id the ID of the file.
* @return mixed the thumbnail.
*/
$files->thumbnail($token, $id);/* @param int $id the id of the item.
* @param string $token the OAuth token.
* @param string $access the level of access required for this shared link.
* @param string|null $unshared_at the day that this link should be disabled at.
* @param bool|null $can_download whether this link allows downloads.
* @param bool|null $can_preview whether this link allows previewing.
* @return array the full folder with the updated shared link.
*/
$files->createSharedLink($id, $token, $access, $unshared_at = null, $can_download = null, $can_preview = null);/* @param string $token the OAuth token.
* @param array $fields attribute(s) to include in the response.
* @param int|null $limit the maximum number of items to return.
* @param int|null $offset the item at which to begin the response.
* @return array the items in the trash.
*/
$files->getTrashed($id, $token);/* @param int $id the id of the item.
* @param string $token the OAuth token.
* @return void
*/
$files->deleteTrashed($id, $token);/* @param int $id the id of the item.
* @param string $token the OAuth token.
* @param string $name the new name of the item.
* @param int $parent the id of the file to place the restored folder in.
* @return array the folder.
*/
$files->restoreTrashed($id, $token, $name, $parent);/* @param int $id the id of the file.
* @param string $token the OAuth token.
* @param array $fields the fields to include in the response.
* @return array the response.
*/
$files->getComments($id, $token, $fields = []);/* @param string $token the OAuth token.
* @param int $id the ID of the file.
* @return array the tasks.
*/
$files->getTasks($token, $id);