UNPKG

dropbox

Version:

The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.

1,084 lines (1,008 loc) 174 kB
// Auto-generated by Stone, do not modify. var routes = {}; /** * Sets a user's profile photo. * Route attributes: * scope: account_info.write * @function Dropbox#accountSetProfilePhoto * @arg {AccountSetProfilePhotoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AccountSetProfilePhotoResult>, DropboxResponseError.<AccountSetProfilePhotoError>>} */ routes.accountSetProfilePhoto = function (arg) { return this.request('account/set_profile_photo', arg, 'user', 'api', 'rpc', 'account_info.write'); }; /** * Creates an OAuth 2.0 access token from the supplied OAuth 1.0 access token. * @function Dropbox#authTokenFromOauth1 * @arg {AuthTokenFromOAuth1Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AuthTokenFromOAuth1Result>, DropboxResponseError.<AuthTokenFromOAuth1Error>>} */ routes.authTokenFromOauth1 = function (arg) { return this.request('auth/token/from_oauth1', arg, 'app', 'api', 'rpc', null); }; /** * Disables the access token used to authenticate the call. If there is a * corresponding refresh token for the access token, this disables that refresh * token, as well as any other access tokens for that refresh token. * @function Dropbox#authTokenRevoke * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<void>>} */ routes.authTokenRevoke = function () { return this.request('auth/token/revoke', null, 'user', 'api', 'rpc', null); }; /** * This endpoint performs App Authentication, validating the supplied app key * and secret, and returns the supplied string, to allow you to test your code * and connection to the Dropbox API. It has no other effect. If you receive an * HTTP 200 response with the supplied query, it indicates at least part of the * Dropbox API infrastructure is working and that the app key and secret valid. * @function Dropbox#checkApp * @arg {CheckEchoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<CheckEchoResult>, DropboxResponseError.<void>>} */ routes.checkApp = function (arg) { return this.request('check/app', arg, 'app', 'api', 'rpc', null); }; /** * This endpoint performs User Authentication, validating the supplied access * token, and returns the supplied string, to allow you to test your code and * connection to the Dropbox API. It has no other effect. If you receive an HTTP * 200 response with the supplied query, it indicates at least part of the * Dropbox API infrastructure is working and that the access token is valid. * Route attributes: * scope: account_info.read * @function Dropbox#checkUser * @arg {CheckEchoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<CheckEchoResult>, DropboxResponseError.<void>>} */ routes.checkUser = function (arg) { return this.request('check/user', arg, 'user', 'api', 'rpc', 'account_info.read'); }; /** * Removes all manually added contacts. You'll still keep contacts who are on * your team or who you imported. New contacts will be added when you share. * Route attributes: * scope: contacts.write * @function Dropbox#contactsDeleteManualContacts * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<void>>} */ routes.contactsDeleteManualContacts = function () { return this.request('contacts/delete_manual_contacts', null, 'user', 'api', 'rpc', 'contacts.write'); }; /** * Removes manually added contacts from the given list. * Route attributes: * scope: contacts.write * @function Dropbox#contactsDeleteManualContactsBatch * @arg {ContactsDeleteManualContactsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<ContactsDeleteManualContactsError>>} */ routes.contactsDeleteManualContactsBatch = function (arg) { return this.request('contacts/delete_manual_contacts_batch', arg, 'user', 'api', 'rpc', 'contacts.write'); }; /** * Add property groups to a Dropbox file. See templates/add_for_user or * templates/add_for_team to create new templates. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesAdd * @arg {FilePropertiesAddPropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesAddPropertiesError>>} */ routes.filePropertiesPropertiesAdd = function (arg) { return this.request('file_properties/properties/add', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Overwrite property groups associated with a file. This endpoint should be * used instead of properties/update when property groups are being updated via * a "snapshot" instead of via a "delta". In other words, this endpoint will * delete all omitted fields from a property group, whereas properties/update * will only delete fields that are explicitly marked for deletion. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesOverwrite * @arg {FilePropertiesOverwritePropertyGroupArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesInvalidPropertyGroupError>>} */ routes.filePropertiesPropertiesOverwrite = function (arg) { return this.request('file_properties/properties/overwrite', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Permanently removes the specified property group from the file. To remove * specific property field key value pairs, see properties/update. To update a * template, see templates/update_for_user or templates/update_for_team. To * remove a template, see templates/remove_for_user or * templates/remove_for_team. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesRemove * @arg {FilePropertiesRemovePropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesRemovePropertiesError>>} */ routes.filePropertiesPropertiesRemove = function (arg) { return this.request('file_properties/properties/remove', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Search across property templates for particular property field values. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesPropertiesSearch * @arg {FilePropertiesPropertiesSearchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesPropertiesSearchResult>, DropboxResponseError.<FilePropertiesPropertiesSearchError>>} */ routes.filePropertiesPropertiesSearch = function (arg) { return this.request('file_properties/properties/search', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Once a cursor has been retrieved from properties/search, use this to paginate * through all search results. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesPropertiesSearchContinue * @arg {FilePropertiesPropertiesSearchContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesPropertiesSearchResult>, DropboxResponseError.<FilePropertiesPropertiesSearchContinueError>>} */ routes.filePropertiesPropertiesSearchContinue = function (arg) { return this.request('file_properties/properties/search/continue', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Add, update or remove properties associated with the supplied file and * templates. This endpoint should be used instead of properties/overwrite when * property groups are being updated via a "delta" instead of via a "snapshot" . * In other words, this endpoint will not delete any omitted fields from a * property group, whereas properties/overwrite will delete any fields that are * omitted from a property group. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesUpdate * @arg {FilePropertiesUpdatePropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesUpdatePropertiesError>>} */ routes.filePropertiesPropertiesUpdate = function (arg) { return this.request('file_properties/properties/update', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Add a template associated with a team. See properties/add to add properties * to a file or folder. Note: this endpoint will create team-owned templates. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesAddForTeam * @arg {FilePropertiesAddTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesAddTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesAddForTeam = function (arg) { return this.request('file_properties/templates/add_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Add a template associated with a user. See properties/add to add properties * to a file. This endpoint can't be called on a team member or admin's behalf. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesTemplatesAddForUser * @arg {FilePropertiesAddTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesAddTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesAddForUser = function (arg) { return this.request('file_properties/templates/add_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Get the schema for a specified template. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesGetForTeam * @arg {FilePropertiesGetTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesGetForTeam = function (arg) { return this.request('file_properties/templates/get_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Get the schema for a specified template. This endpoint can't be called on a * team member or admin's behalf. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesTemplatesGetForUser * @arg {FilePropertiesGetTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesGetForUser = function (arg) { return this.request('file_properties/templates/get_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Get the template identifiers for a team. To get the schema of each template * use templates/get_for_team. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesListForTeam * @returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesListForTeam = function () { return this.request('file_properties/templates/list_for_team', null, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Get the template identifiers for a team. To get the schema of each template * use templates/get_for_user. This endpoint can't be called on a team member or * admin's behalf. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesTemplatesListForUser * @returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesListForUser = function () { return this.request('file_properties/templates/list_for_user', null, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Permanently removes the specified template created from * templates/add_for_user. All properties associated with the template will also * be removed. This action cannot be undone. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesRemoveForTeam * @arg {FilePropertiesRemoveTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesRemoveForTeam = function (arg) { return this.request('file_properties/templates/remove_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Permanently removes the specified template created from * templates/add_for_user. All properties associated with the template will also * be removed. This action cannot be undone. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesTemplatesRemoveForUser * @arg {FilePropertiesRemoveTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesRemoveForUser = function (arg) { return this.request('file_properties/templates/remove_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Update a template associated with a team. This route can update the template * name, the template description and add optional properties to templates. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesUpdateForTeam * @arg {FilePropertiesUpdateTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesUpdateTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesUpdateForTeam = function (arg) { return this.request('file_properties/templates/update_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Update a template associated with a user. This route can update the template * name, the template description and add optional properties to templates. This * endpoint can't be called on a team member or admin's behalf. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesTemplatesUpdateForUser * @arg {FilePropertiesUpdateTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesUpdateTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesUpdateForUser = function (arg) { return this.request('file_properties/templates/update_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Returns the total number of file requests owned by this user. Includes both * open and closed file requests. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsCount * @returns {Promise.<DropboxResponse<FileRequestsCountFileRequestsResult>, DropboxResponseError.<FileRequestsCountFileRequestsError>>} */ routes.fileRequestsCount = function () { return this.request('file_requests/count', null, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Creates a file request for this user. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsCreate * @arg {FileRequestsCreateFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsCreateFileRequestError>>} */ routes.fileRequestsCreate = function (arg) { return this.request('file_requests/create', arg, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Delete a batch of closed file requests. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsDelete * @arg {FileRequestsDeleteFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsDeleteFileRequestsResult>, DropboxResponseError.<FileRequestsDeleteFileRequestError>>} */ routes.fileRequestsDelete = function (arg) { return this.request('file_requests/delete', arg, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Delete all closed file requests owned by this user. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsDeleteAllClosed * @returns {Promise.<DropboxResponse<FileRequestsDeleteAllClosedFileRequestsResult>, DropboxResponseError.<FileRequestsDeleteAllClosedFileRequestsError>>} */ routes.fileRequestsDeleteAllClosed = function () { return this.request('file_requests/delete_all_closed', null, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Returns the specified file request. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsGet * @arg {FileRequestsGetFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsGetFileRequestError>>} */ routes.fileRequestsGet = function (arg) { return this.request('file_requests/get', arg, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Returns a list of file requests owned by this user. For apps with the app * folder permission, this will only return file requests with destinations in * the app folder. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsListV2 * @arg {FileRequestsListFileRequestsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsListFileRequestsV2Result>, DropboxResponseError.<FileRequestsListFileRequestsError>>} */ routes.fileRequestsListV2 = function (arg) { return this.request('file_requests/list_v2', arg, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Returns a list of file requests owned by this user. For apps with the app * folder permission, this will only return file requests with destinations in * the app folder. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsList * @returns {Promise.<DropboxResponse<FileRequestsListFileRequestsResult>, DropboxResponseError.<FileRequestsListFileRequestsError>>} */ routes.fileRequestsList = function () { return this.request('file_requests/list', null, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Once a cursor has been retrieved from list_v2, use this to paginate through * all file requests. The cursor must come from a previous call to list_v2 or * list/continue. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsListContinue * @arg {FileRequestsListFileRequestsContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsListFileRequestsV2Result>, DropboxResponseError.<FileRequestsListFileRequestsContinueError>>} */ routes.fileRequestsListContinue = function (arg) { return this.request('file_requests/list/continue', arg, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Update a file request. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsUpdate * @arg {FileRequestsUpdateFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsUpdateFileRequestError>>} */ routes.fileRequestsUpdate = function (arg) { return this.request('file_requests/update', arg, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Returns the metadata for a file or folder. This is an alpha endpoint * compatible with the properties API. Note: Metadata for the root folder is * unsupported. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesAlphaGetMetadata * @deprecated * @arg {FilesAlphaGetMetadataArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesAlphaGetMetadataError>>} */ routes.filesAlphaGetMetadata = function (arg) { return this.request('files/alpha/get_metadata', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Create a new file with the contents provided in the request. Note that the * behavior of this alpha endpoint is unstable and subject to change. Do not use * this to upload a file larger than 150 MB. Instead, create an upload session * with upload_session/start. * Route attributes: * scope: files.content.write * @function Dropbox#filesAlphaUpload * @deprecated * @arg {FilesUploadArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesUploadError>>} */ routes.filesAlphaUpload = function (arg) { return this.request('files/alpha/upload', arg, 'user', 'content', 'upload', 'files.content.write'); }; /** * Copy a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be copied. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyV2 * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationResult>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesCopyV2 = function (arg) { return this.request('files/copy_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Copy a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be copied. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopy * @deprecated * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesCopy = function (arg) { return this.request('files/copy', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Copy multiple files or folders to different locations at once in the user's * Dropbox. This route will replace copy_batch. The main difference is this * route will return status for each entry, while copy_batch raises failure if * any entry fails. This route will either finish synchronously, or return a job * ID and do the async copy job in background. Please use copy_batch/check_v2 to * check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatchV2 * @arg {Object} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2Launch>, DropboxResponseError.<void>>} */ routes.filesCopyBatchV2 = function (arg) { return this.request('files/copy_batch_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Copy multiple files or folders to different locations at once in the user's * Dropbox. This route will return job ID immediately and do the async copy job * in background. Please use copy_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatch * @deprecated * @arg {FilesRelocationBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesCopyBatch = function (arg) { return this.request('files/copy_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for copy_batch_v2. It returns list * of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatchCheckV2 * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2JobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesCopyBatchCheckV2 = function (arg) { return this.request('files/copy_batch/check_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for copy_batch. If success, it * returns list of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatchCheck * @deprecated * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesCopyBatchCheck = function (arg) { return this.request('files/copy_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Get a copy reference to a file or folder. This reference string can be used * to save that file or folder to another user's Dropbox by passing it to * copy_reference/save. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyReferenceGet * @arg {FilesGetCopyReferenceArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetCopyReferenceResult>, DropboxResponseError.<FilesGetCopyReferenceError>>} */ routes.filesCopyReferenceGet = function (arg) { return this.request('files/copy_reference/get', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Save a copy reference returned by copy_reference/get to the user's Dropbox. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyReferenceSave * @arg {FilesSaveCopyReferenceArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesSaveCopyReferenceResult>, DropboxResponseError.<FilesSaveCopyReferenceError>>} */ routes.filesCopyReferenceSave = function (arg) { return this.request('files/copy_reference/save', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Create a folder at a given path. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolderV2 * @arg {FilesCreateFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesCreateFolderResult>, DropboxResponseError.<FilesCreateFolderError>>} */ routes.filesCreateFolderV2 = function (arg) { return this.request('files/create_folder_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Create a folder at a given path. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolder * @deprecated * @arg {FilesCreateFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFolderMetadata>, DropboxResponseError.<FilesCreateFolderError>>} */ routes.filesCreateFolder = function (arg) { return this.request('files/create_folder', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Create multiple folders at once. This route is asynchronous for large * batches, which returns a job ID immediately and runs the create folder batch * asynchronously. Otherwise, creates the folders and returns the result * synchronously for smaller inputs. You can force asynchronous behaviour by * using the CreateFolderBatchArg.force_async flag. Use * create_folder_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolderBatch * @arg {FilesCreateFolderBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesCreateFolderBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesCreateFolderBatch = function (arg) { return this.request('files/create_folder_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for create_folder_batch. If * success, it returns list of result for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolderBatchCheck * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesCreateFolderBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesCreateFolderBatchCheck = function (arg) { return this.request('files/create_folder_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Delete the file or folder at a given path. If the path is a folder, all its * contents will be deleted too. A successful response indicates that the file * or folder was deleted. The returned metadata will be the corresponding * FileMetadata or FolderMetadata for the item at time of deletion, and not a * DeletedMetadata object. * Route attributes: * scope: files.content.write * @function Dropbox#filesDeleteV2 * @arg {FilesDeleteArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDeleteResult>, DropboxResponseError.<FilesDeleteError>>} */ routes.filesDeleteV2 = function (arg) { return this.request('files/delete_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Delete the file or folder at a given path. If the path is a folder, all its * contents will be deleted too. A successful response indicates that the file * or folder was deleted. The returned metadata will be the corresponding * FileMetadata or FolderMetadata for the item at time of deletion, and not a * DeletedMetadata object. * Route attributes: * scope: files.content.write * @function Dropbox#filesDelete * @deprecated * @arg {FilesDeleteArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesDeleteError>>} */ routes.filesDelete = function (arg) { return this.request('files/delete', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Delete multiple files/folders at once. This route is asynchronous, which * returns a job ID immediately and runs the delete batch asynchronously. Use * delete_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesDeleteBatch * @arg {FilesDeleteBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDeleteBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesDeleteBatch = function (arg) { return this.request('files/delete_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for delete_batch. If success, it * returns list of result for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesDeleteBatchCheck * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDeleteBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesDeleteBatchCheck = function (arg) { return this.request('files/delete_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Download a file from a user's Dropbox. * Route attributes: * scope: files.content.read * @function Dropbox#filesDownload * @arg {FilesDownloadArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesDownloadError>>} */ routes.filesDownload = function (arg) { return this.request('files/download', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Download a folder from the user's Dropbox, as a zip file. The folder must be * less than 20 GB in size and any single file within must be less than 4 GB in * size. The resulting zip must have fewer than 10,000 total file and folder * entries, including the top level folder. The input cannot be a single file. * Note: this endpoint does not support HTTP range requests. * Route attributes: * scope: files.content.read * @function Dropbox#filesDownloadZip * @arg {FilesDownloadZipArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDownloadZipResult>, DropboxResponseError.<FilesDownloadZipError>>} */ routes.filesDownloadZip = function (arg) { return this.request('files/download_zip', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Export a file from a user's Dropbox. This route only supports exporting files * that cannot be downloaded directly and whose ExportResult.file_metadata has * ExportInfo.export_as populated. * Route attributes: * scope: files.content.read * @function Dropbox#filesExport * @arg {FilesExportArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesExportResult>, DropboxResponseError.<FilesExportError>>} */ routes.filesExport = function (arg) { return this.request('files/export', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Return the lock metadata for the given list of paths. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetFileLockBatch * @arg {FilesLockFileBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesLockFileBatchResult>, DropboxResponseError.<FilesLockFileError>>} */ routes.filesGetFileLockBatch = function (arg) { return this.request('files/get_file_lock_batch', arg, 'user', 'api', 'rpc', 'files.content.read'); }; /** * Returns the metadata for a file or folder. Note: Metadata for the root folder * is unsupported. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesGetMetadata * @arg {FilesGetMetadataArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesGetMetadataError>>} */ routes.filesGetMetadata = function (arg) { return this.request('files/get_metadata', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Get a preview for a file. Currently, PDF previews are generated for files * with the following extensions: .ai, .doc, .docm, .docx, .eps, .gdoc, * .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf. HTML * previews are generated for files with the following extensions: .csv, .ods, * .xls, .xlsm, .gsheet, .xlsx. Other formats will return an unsupported * extension error. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetPreview * @arg {FilesPreviewArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesPreviewError>>} */ routes.filesGetPreview = function (arg) { return this.request('files/get_preview', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Get a temporary link to stream content of a file. This link will expire in * four hours and afterwards you will get 410 Gone. This URL should not be used * to display content directly in the browser. The Content-Type of the link is * determined automatically by the file's mime type. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetTemporaryLink * @arg {FilesGetTemporaryLinkArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetTemporaryLinkResult>, DropboxResponseError.<FilesGetTemporaryLinkError>>} */ routes.filesGetTemporaryLink = function (arg) { return this.request('files/get_temporary_link', arg, 'user', 'api', 'rpc', 'files.content.read'); }; /** * Get a one-time use temporary upload link to upload a file to a Dropbox * location. This endpoint acts as a delayed upload. The returned temporary * upload link may be used to make a POST request with the data to be uploaded. * The upload will then be perfomed with the CommitInfo previously provided to * get_temporary_upload_link but evaluated only upon consumption. Hence, errors * stemming from invalid CommitInfo with respect to the state of the user's * Dropbox will only be communicated at consumption time. Additionally, these * errors are surfaced as generic HTTP 409 Conflict responses, potentially * hiding issue details. The maximum temporary upload link duration is 4 hours. * Upon consumption or expiration, a new link will have to be generated. * Multiple links may exist for a specific upload path at any given time. The * POST request on the temporary upload link must have its Content-Type set to * "application/octet-stream". Example temporary upload link consumption * request: curl -X POST * https://content.dropboxapi.com/apitul/1/bNi2uIYF51cVBND --header * "Content-Type: application/octet-stream" --data-binary @local_file.txt A * successful temporary upload link consumption request returns the content hash * of the uploaded data in JSON format. Example successful temporary upload * link consumption response: {"content-hash": * "599d71033d700ac892a0e48fa61b125d2f5994"} An unsuccessful temporary upload * link consumption request returns any of the following status codes: HTTP 400 * Bad Request: Content-Type is not one of application/octet-stream and * text/plain or request is invalid. HTTP 409 Conflict: The temporary upload * link does not exist or is currently unavailable, the upload failed, or * another error happened. HTTP 410 Gone: The temporary upload link is expired * or consumed. Example unsuccessful temporary upload link consumption * response: Temporary upload link has been recently consumed. * Route attributes: * scope: files.content.write * @function Dropbox#filesGetTemporaryUploadLink * @arg {FilesGetTemporaryUploadLinkArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetTemporaryUploadLinkResult>, DropboxResponseError.<void>>} */ routes.filesGetTemporaryUploadLink = function (arg) { return this.request('files/get_temporary_upload_link', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Get a thumbnail for an image. This method currently supports files with the * following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. * Photos that are larger than 20MB in size won't be converted to a thumbnail. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetThumbnail * @arg {FilesThumbnailArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesThumbnailError>>} */ routes.filesGetThumbnail = function (arg) { return this.request('files/get_thumbnail', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Get a thumbnail for an image. This method currently supports files with the * following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. * Photos that are larger than 20MB in size won't be converted to a thumbnail. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetThumbnailV2 * @arg {FilesThumbnailV2Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesPreviewResult>, DropboxResponseError.<FilesThumbnailV2Error>>} */ routes.filesGetThumbnailV2 = function (arg) { return this.request('files/get_thumbnail_v2', arg, 'app, user', 'content', 'download', 'files.content.read'); }; /** * Get thumbnails for a list of images. We allow up to 25 thumbnails in a single * batch. This method currently supports files with the following file * extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that * are larger than 20MB in size won't be converted to a thumbnail. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetThumbnailBatch * @arg {FilesGetThumbnailBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetThumbnailBatchResult>, DropboxResponseError.<FilesGetThumbnailBatchError>>} */ routes.filesGetThumbnailBatch = function (arg) { return this.request('files/get_thumbnail_batch', arg, 'user', 'content', 'rpc', 'files.content.read'); }; /** * Starts returning the contents of a folder. If the result's * ListFolderResult.has_more field is true, call list_folder/continue with the * returned ListFolderResult.cursor to retrieve more entries. If you're using * ListFolderArg.recursive set to true to keep a local cache of the contents of * a Dropbox account, iterate through each entry in order and process them as * follows to keep your local state in sync: For each FileMetadata, store the * new entry at the given path in your local state. If the required parent * folders don't exist yet, create them. If there's already something else at * the given path, replace it and remove all its children. For each * FolderMetadata, store the new entry at the given path in your local state. If * the required parent folders don't exist yet, create them. If there's already * something else at the given path, replace it but leave the children as they * are. Check the new entry's FolderSharingInfo.read_only and set all its * children's read-only statuses to match. For each DeletedMetadata, if your * local state has something at the given path, remove it and all its children. * If there's nothing at the given path, ignore this entry. Note: * auth.RateLimitError may be returned if multiple list_folder or * list_folder/continue calls with same parameters are made simultaneously by * same API app for same user. If your app implements retry logic, please hold * off the retry until the previous request finishes. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolder * @arg {FilesListFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderResult>, DropboxResponseError.<FilesListFolderError>>} */ routes.filesListFolder = function (arg) { return this.request('files/list_folder', arg, 'app, user', 'api', 'rpc', 'files.metadata.read'); }; /** * Once a cursor has been retrieved from list_folder, use this to paginate * through all files and retrieve updates to the folder, following the same * rules as documented for list_folder. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolderContinue * @arg {FilesListFolderContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderResult>, DropboxResponseError.<FilesListFolderContinueError>>} */ routes.filesListFolderContinue = function (arg) { return this.request('files/list_folder/continue', arg, 'app, user', 'api', 'rpc', 'files.metadata.read'); }; /** * A way to quickly get a cursor for the folder's state. Unlike list_folder, * list_folder/get_latest_cursor doesn't return any entries. This endpoint is * for app which only needs to know about new files and modifications and * doesn't need to know about files that already exist in Dropbox. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolderGetLatestCursor * @arg {FilesListFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderGetLatestCursorResult>, DropboxResponseError.<FilesListFolderError>>} */ routes.filesListFolderGetLatestCursor = function (arg) { return this.request('files/list_folder/get_latest_cursor', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * A longpoll endpoint to wait for changes on an account. In conjunction with * list_folder/continue, this call gives you a low-latency way to monitor an * account for file changes. The connection will block until there are changes * available or a timeout occurs. This endpoint is useful mostly for client-side * apps. If you're looking for server-side notifications, check out our webhooks * documentation https://www.dropbox.com/developers/reference/webhooks. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolderLongpoll * @arg {FilesListFolderLongpollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderLongpollResult>, DropboxResponseError.<FilesListFolderLongpollError>>} */ routes.filesListFolderLongpoll = function (arg) { return this.request('files/list_folder/longpoll', arg, 'noauth', 'notify', 'rpc', 'files.metadata.read'); }; /** * Returns revisions for files based on a file path or a file id. The file path * or file id is identified from the latest file entry at the given file path or * id. This end point allows your app to query either by file path or file id by * setting the mode parameter appropriately. In the ListRevisionsMode.path * (default) mode, all revisions at the same file path as the latest file entry * are returned. If revisions with the same file id are desired, then mode must * be set to ListRevisionsMode.id. The ListRevisionsMode.id mode is useful to * retrieve revisions for a given file across moves or renames. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListRevisions * @arg {FilesListRevisionsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListRevisionsResult>, DropboxResponseError.<FilesListRevisionsError>>} */ routes.filesListRevisions = function (arg) { return this.request('files/list_revisions', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Lock the files at the given paths. A locked file will be writable only by the * lock holder. A successful response indicates that the file has been locked. * Returns a list of the locked file paths and their metadata after this * operation. * Route attributes: * scope: files.content.write * @function Dropbox#filesLockFileBatch * @arg {FilesLockFileBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesLockFileBatchResult>, DropboxResponseError.<FilesLockFileError>>} */ routes.filesLockFileBatch = function (arg) { return this.request('files/lock_file_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be moved. Note that we do not * currently support case-only renaming. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveV2 * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationResult>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesMoveV2 = function (arg) { return this.request('files/move_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be moved. * Route attributes: * scope: files.content.write * @function Dropbox#filesMove * @deprecated * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesMove = function (arg) { return this.request('files/move', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move multiple files or folders to different locations at once in the user's * Dropbox. Note that we do not currently support case-only renaming. This route * will replace move_batch. The main difference is this route will return status * for each entry, while move_batch raises failure if any entry fails. This * route will either finish synchronously, or return a job ID and do the async * move job in background. Please use move_batch/check_v2 to check the job * status. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatchV2 * @arg {FilesMoveBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2Launch>, DropboxResponseError.<void>>} */ routes.filesMoveBatchV2 = function (arg) { return this.request('files/move_batch_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move multiple files or folders to different locations at once in the user's * Dropbox. This route will return job ID immediately and do the async moving * job in background. Please use move_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatch * @deprecated * @arg {FilesRelocationBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesMoveBatch = function (arg) { return this.request('files/move_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for move_batch_v2. It returns list * of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatchCheckV2 * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2JobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesMoveBatchCheckV2 = function (arg) { return this.request('files/move_batch/check_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for move_batch. If success, it * returns list of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatchCheck * @deprecated * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesMoveBatchCheck = function (arg) { return this.request('files/move_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Creates a new Paper doc with the provided content. * Route attributes: * scope: files.content.write * @function Dropbox#filesPaperCreate * @arg {FilesPaperCreateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesPaperCreateResult>, DropboxResponseError.<FilesPaperCreateError>>} */ routes.filesPaperCreate = function (arg) { return this.request('files/paper/create', arg, 'user', 'api', 'upload', 'files.content.write'); }; /** * Updates an existing Paper doc with the provided content. * Route attributes: * scope: files.content.write * @function Dropbox#filesPaperUpdate * @arg {FilesPaperUpdateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesPaperUpdateResult>, DropboxResponseError.<FilesPaperUpdateError>>} */ routes.filesPaperUpdate = function (arg) { return this.request('files/paper/update', arg, 'user', 'api', 'upload', 'files.content.write'); }; /** * Permanently delete the file or folder at a given path (see * https: