You are here

public function BackupMigrateDropboxAPI::create_folder in Backup and Migrate Dropbox 7.3

Same name and namespace in other branches
  1. 7.2 backup_migrate_dropbox.dropbox_api.inc \BackupMigrateDropboxAPI::create_folder()

Creates a folder on Dropbox.

@link https://www.dropbox.com/developers/documentation/http/documentation#file...

Parameters

string $folder: The folder to create.

Return value

object A list of folder metadata for the created folder.

Throws

RuntimeException The folder could not be created. If that is because it already exists, the exception message will contain something like '... path/conflict/folder/.. ...'.

File

./backup_migrate_dropbox.dropbox_api.inc, line 293

Class

BackupMigrateDropboxAPI
BackupMigrateDropboxAPI contains all the details about the Dropbox api, authorization calls, endpoints, uris, parameters, error handling, and split requests for large uploads/downloads

Code

public function create_folder($folder) {
  if ($folder[0] !== '/') {
    $folder = '/' . $folder;
  }
  $parameters = [
    'path' => $folder,
    'autorename' => FALSE,
  ];
  return $this
    ->send_message('api', 'files/create_folder', $parameters);
}