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,209 lines (1,111 loc) 171 kB
// Auto-generated by Stone, do not modify. import { account, async, auth, check, common, contacts, file_properties, file_requests, files, openid, paper, secondary_emails, seen_state, sharing, team, team_common, team_log, team_policies, users, users_common } from './dropbox_types'; export * from './dropbox_types'; export interface DropboxAuthOptions { // An access token for making authenticated requests. accessToken?: string; // The time at which the access token expires. accessTokenExpiresAt?: Date; // A refresh token for retrieving access tokens refreshToken?: string; // The client id for your app. Used to create authentication URL. clientId?: string; // The client secret for your app. Used for refresh and token exchange. clientSecret?: string; // The fetch library for making requests. fetch?: Function; // A custom domain to use when making api requests. This should only be used for testing as scaffolding to avoid making network requests. domain?: string; // A custom delimiter to use when separating domain from subdomain. This should only be used for testing as scaffolding. domainDelimiter?: string; // An object (in the form of header: value) designed to set custom headers to use during a request. customHeaders?: object; // Whether request data is sent on body or as URL params. Defaults to false. dataOnBody?: boolean; } export class DropboxAuth { /** * The DropboxAuth class that provides methods to manage, acquire, and refresh tokens. */ constructor(); /** * The DropboxAuth class that provides methods to manage, acquire, and refresh tokens. */ constructor(options: DropboxAuthOptions); /** * Get the access token * @returns {String} Access token */ getAccessToken(): string; /** * Get an OAuth2 access token from an OAuth2 Code. * @param redirectUri A URL to redirect the user to after authenticating. * This must be added to your app through the admin interface. * @param code An OAuth2 code. * @returns {Object} An object containing the token and related info (if applicable) */ getAccessTokenFromCode(redirectUri: string, code: string): Promise<DropboxResponse<object>>; /** * Get a URL that can be used to authenticate users for the Dropbox API. * @arg {String} redirectUri - A URL to redirect the user to after * authenticating. This must be added to your app through the admin interface. * @arg {String} [state] - State that will be returned in the redirect URL to help * prevent cross site scripting attacks. * @arg {String} [authType] - auth type, defaults to 'token', other option is 'code' * @arg {String} [tokenAccessType] - type of token to request. From the following: * null - creates a token with the app default (either legacy or online) * legacy - creates one long-lived token with no expiration * online - create one short-lived token with an expiration * offline - create one short-lived token with an expiration with a refresh token * @arg {Array<String>} [scope] - scopes to request for the grant * @arg {String} [includeGrantedScopes] - whether or not to include previously granted scopes. * From the following: * user - include user scopes in the grant * team - include team scopes in the grant * Note: if this user has never linked the app, include_granted_scopes must be None * @arg {boolean} [usePKCE] - Whether or not to use Sha256 based PKCE. PKCE should be only use on * client apps which doesn't call your server. It is less secure than non-PKCE flow but * can be used if you are unable to safely retrieve your app secret * @returns {Promise<String>} - Url to send user to for Dropbox API authentication * returned in a promise */ getAuthenticationUrl(redirectUri: string, state?: string, authType?: 'token' | 'code', tokenAccessType?: null | 'legacy' | 'offline' | 'online', scope?: Array<String>, includeGrantedScopes?: 'none' | 'user' | 'team', usePKCE?: boolean): Promise<String>; /** * Get the client id * @returns {String} Client id */ getClientId(): string; /** * Set the access token used to authenticate requests to the API. * @param accessToken An access token. */ setAccessToken(accessToken: string): void; /** * Set the client id, which is used to help gain an access token. * @param clientId Your app's client ID. */ setClientId(clientId: string): void; /** * Set the client secret * @param clientSecret Your app's client secret. */ setClientSecret(clientSecret: string): void; /** * Sets the refresh token * @param refreshToken - A refresh token */ setRefreshToken(refreshToken: string): void; /** * Gets the refresh token * @returns {String} Refresh token */ getRefreshToken(): string; /** * Sets the access token's expiration date * @param accessTokenExpiresAt - new expiration date */ setAccessTokenExpiresAt(accessTokenExpiresAt: Date): void; /** * Gets the access token's expiration date * @returns {Date} date of token expiration */ getAccessTokenExpiresAt(): Date; /** * Sets the code verifier for PKCE flow * @param {String} codeVerifier - new code verifier */ setCodeVerifier(codeVerifier: string): void; /** * Gets the code verifier for PKCE flow * @returns {String} - code verifier for PKCE */ getCodeVerifier(): string; /** * Checks if a token is needed, can be refreshed and if the token is expired. * If so, attempts to refresh access token * @returns {Promise<*>} */ checkAndRefreshAccessToken(): void; /** * Refreshes the access token using the refresh token, if available * @arg {List} scope - a subset of scopes from the original * refresh to acquire with an access token * @returns {Promise<*>} */ refreshAccessToken(scope?: Array<String>): void; } export interface DropboxOptions { // Select user is only used for team functionality. It specifies which user the team access token should be acting as. selectUser?: string; // Select admin is only used by team functionality. It specifies which team admin the team access token should be acting as. selectAdmin?: string; // Root path to access other namespaces. Use to access team folders for example pathRoot?: string; // The DropboxAuth object used to authenticate requests. If this is set, the remaining parameters will be ignored. auth?: DropboxAuth | null; // An access token for making authenticated requests. accessToken?: string; // The time at which the access token expires. accessTokenExpiresAt?: Date; // A refresh token for retrieving access tokens refreshToken?: string; // The client id for your app. Used to create authentication URL. clientId?: string; // The client secret for your app. Used for refresh and token exchange. clientSecret?: string; // The fetch library for making requests. fetch?: Function; // A custom domain to use when making api requests. This should only be used for testing as scaffolding to avoid making network requests. domain?: string; // A custom delimiter to use when separating domain subdomain. This should only be used for testing as scaffolding. domainDelimiter?: string; // An object (in the form of header: value) designed to set custom headers to use during a request. customHeaders?: object; } export class DropboxResponseError<T> { /** * The response class of HTTP errors from API calls using the Dropbox SDK. */ constructor(status: number, headers: any, error: T); /** * HTTP Status code of the call */ status: number; /** * Headers returned from the call. Set as any to support both node and browser. */ headers: any; /** * Serialized Error of the call */ error: T; } export class DropboxResponse<T> { /** * The response class of all successful API calls using the Dropbox SDK. */ constructor(status: number, headers: any, result: T); /** * HTTP Status code of the call */ status: number; /** * Headers returned from the call. Set as any to support both node and browser. */ headers: any; /** * Serialized Result of the call */ result: T; } export class Dropbox { /** * The Dropbox SDK class that provides methods to read, write and * create files or folders in a user or team's Dropbox. */ constructor(); /** * The Dropbox SDK class that provides methods to read, write and * create files or folders in a user or team's Dropbox. */ constructor(options: DropboxOptions); /*ROUTES*/ /** * Sets a user's profile photo. * * Route attributes: * scope: account_info.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<account.SetProfilePhotoError>. * @param arg The request parameters. */ public accountSetProfilePhoto(arg: account.SetProfilePhotoArg): Promise<DropboxResponse<account.SetProfilePhotoResult>>; /** * Creates an OAuth 2.0 access token from the supplied OAuth 1.0 access * token. * * When an error occurs, the route rejects the promise with type * DropboxResponseError<auth.TokenFromOAuth1Error>. * @param arg The request parameters. */ public authTokenFromOauth1(arg: auth.TokenFromOAuth1Arg): Promise<DropboxResponse<auth.TokenFromOAuth1Result>>; /** * 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. * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. */ public authTokenRevoke(): Promise<DropboxResponse<void>>; /** * 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. * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. * @param arg The request parameters. */ public checkApp(arg: check.EchoArg): Promise<DropboxResponse<check.EchoResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. * @param arg The request parameters. */ public checkUser(arg: check.EchoArg): Promise<DropboxResponse<check.EchoResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. */ public contactsDeleteManualContacts(): Promise<DropboxResponse<void>>; /** * Removes manually added contacts from the given list. * * Route attributes: * scope: contacts.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<contacts.DeleteManualContactsError>. * @param arg The request parameters. */ public contactsDeleteManualContactsBatch(arg: contacts.DeleteManualContactsArg): Promise<DropboxResponse<void>>; /** * Add property groups to a Dropbox file. See templatesAddForUser() or * templatesAddForTeam() to create new templates. * * Route attributes: * scope: files.metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.AddPropertiesError>. * @param arg The request parameters. */ public filePropertiesPropertiesAdd(arg: file_properties.AddPropertiesArg): Promise<DropboxResponse<void>>; /** * Overwrite property groups associated with a file. This endpoint should be * used instead of propertiesUpdate() 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 * propertiesUpdate() will only delete fields that are explicitly marked for * deletion. * * Route attributes: * scope: files.metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.InvalidPropertyGroupError>. * @param arg The request parameters. */ public filePropertiesPropertiesOverwrite(arg: file_properties.OverwritePropertyGroupArg): Promise<DropboxResponse<void>>; /** * Permanently removes the specified property group from the file. To remove * specific property field key value pairs, see propertiesUpdate(). To * update a template, see templatesUpdateForUser() or * templatesUpdateForTeam(). To remove a template, see * templatesRemoveForUser() or templatesRemoveForTeam(). * * Route attributes: * scope: files.metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.RemovePropertiesError>. * @param arg The request parameters. */ public filePropertiesPropertiesRemove(arg: file_properties.RemovePropertiesArg): Promise<DropboxResponse<void>>; /** * Search across property templates for particular property field values. * * Route attributes: * scope: files.metadata.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.PropertiesSearchError>. * @param arg The request parameters. */ public filePropertiesPropertiesSearch(arg: file_properties.PropertiesSearchArg): Promise<DropboxResponse<file_properties.PropertiesSearchResult>>; /** * Once a cursor has been retrieved from propertiesSearch(), use this to * paginate through all search results. * * Route attributes: * scope: files.metadata.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.PropertiesSearchContinueError>. * @param arg The request parameters. */ public filePropertiesPropertiesSearchContinue(arg: file_properties.PropertiesSearchContinueArg): Promise<DropboxResponse<file_properties.PropertiesSearchResult>>; /** * Add, update or remove properties associated with the supplied file and * templates. This endpoint should be used instead of propertiesOverwrite() * 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 propertiesOverwrite() will delete * any fields that are omitted from a property group. * * Route attributes: * scope: files.metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.UpdatePropertiesError>. * @param arg The request parameters. */ public filePropertiesPropertiesUpdate(arg: file_properties.UpdatePropertiesArg): Promise<DropboxResponse<void>>; /** * Add a template associated with a team. See propertiesAdd() to add * properties to a file or folder. Note: this endpoint will create * team-owned templates. * * Route attributes: * scope: files.team_metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.ModifyTemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesAddForTeam(arg: file_properties.AddTemplateArg): Promise<DropboxResponse<file_properties.AddTemplateResult>>; /** * Add a template associated with a user. See propertiesAdd() 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.ModifyTemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesAddForUser(arg: file_properties.AddTemplateArg): Promise<DropboxResponse<file_properties.AddTemplateResult>>; /** * Get the schema for a specified template. * * Route attributes: * scope: files.team_metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.TemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesGetForTeam(arg: file_properties.GetTemplateArg): Promise<DropboxResponse<file_properties.GetTemplateResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.TemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesGetForUser(arg: file_properties.GetTemplateArg): Promise<DropboxResponse<file_properties.GetTemplateResult>>; /** * Get the template identifiers for a team. To get the schema of each * template use templatesGetForTeam(). * * Route attributes: * scope: files.team_metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.TemplateError>. */ public filePropertiesTemplatesListForTeam(): Promise<DropboxResponse<file_properties.ListTemplateResult>>; /** * Get the template identifiers for a team. To get the schema of each * template use templatesGetForUser(). This endpoint can't be called on a * team member or admin's behalf. * * Route attributes: * scope: files.metadata.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.TemplateError>. */ public filePropertiesTemplatesListForUser(): Promise<DropboxResponse<file_properties.ListTemplateResult>>; /** * Permanently removes the specified template created from * templatesAddForUser(). All properties associated with the template will * also be removed. This action cannot be undone. * * Route attributes: * scope: files.team_metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.TemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesRemoveForTeam(arg: file_properties.RemoveTemplateArg): Promise<DropboxResponse<void>>; /** * Permanently removes the specified template created from * templatesAddForUser(). All properties associated with the template will * also be removed. This action cannot be undone. * * Route attributes: * scope: files.metadata.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.TemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesRemoveForUser(arg: file_properties.RemoveTemplateArg): Promise<DropboxResponse<void>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.ModifyTemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesUpdateForTeam(arg: file_properties.UpdateTemplateArg): Promise<DropboxResponse<file_properties.UpdateTemplateResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_properties.ModifyTemplateError>. * @param arg The request parameters. */ public filePropertiesTemplatesUpdateForUser(arg: file_properties.UpdateTemplateArg): Promise<DropboxResponse<file_properties.UpdateTemplateResult>>; /** * Returns the total number of file requests owned by this user. Includes * both open and closed file requests. * * Route attributes: * scope: file_requests.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.CountFileRequestsError>. */ public fileRequestsCount(): Promise<DropboxResponse<file_requests.CountFileRequestsResult>>; /** * Creates a file request for this user. * * Route attributes: * scope: file_requests.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.CreateFileRequestError>. * @param arg The request parameters. */ public fileRequestsCreate(arg: file_requests.CreateFileRequestArgs): Promise<DropboxResponse<file_requests.FileRequest>>; /** * Delete a batch of closed file requests. * * Route attributes: * scope: file_requests.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.DeleteFileRequestError>. * @param arg The request parameters. */ public fileRequestsDelete(arg: file_requests.DeleteFileRequestArgs): Promise<DropboxResponse<file_requests.DeleteFileRequestsResult>>; /** * Delete all closed file requests owned by this user. * * Route attributes: * scope: file_requests.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.DeleteAllClosedFileRequestsError>. */ public fileRequestsDeleteAllClosed(): Promise<DropboxResponse<file_requests.DeleteAllClosedFileRequestsResult>>; /** * Returns the specified file request. * * Route attributes: * scope: file_requests.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.GetFileRequestError>. * @param arg The request parameters. */ public fileRequestsGet(arg: file_requests.GetFileRequestArgs): Promise<DropboxResponse<file_requests.FileRequest>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.ListFileRequestsError>. * @param arg The request parameters. */ public fileRequestsListV2(arg: file_requests.ListFileRequestsArg): Promise<DropboxResponse<file_requests.ListFileRequestsV2Result>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.ListFileRequestsError>. */ public fileRequestsList(): Promise<DropboxResponse<file_requests.ListFileRequestsResult>>; /** * Once a cursor has been retrieved from listV2(), use this to paginate * through all file requests. The cursor must come from a previous call to * listV2() or listContinue(). * * Route attributes: * scope: file_requests.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.ListFileRequestsContinueError>. * @param arg The request parameters. */ public fileRequestsListContinue(arg: file_requests.ListFileRequestsContinueArg): Promise<DropboxResponse<file_requests.ListFileRequestsV2Result>>; /** * Update a file request. * * Route attributes: * scope: file_requests.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<file_requests.UpdateFileRequestError>. * @param arg The request parameters. */ public fileRequestsUpdate(arg: file_requests.UpdateFileRequestArgs): Promise<DropboxResponse<file_requests.FileRequest>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.AlphaGetMetadataError>. * @deprecated * @param arg The request parameters. */ public filesAlphaGetMetadata(arg: files.AlphaGetMetadataArg): Promise<DropboxResponse<files.FileMetadataReference|files.FolderMetadataReference|files.DeletedMetadataReference>>; /** * 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 uploadSessionStart(). * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.UploadError>. * @deprecated * @param arg The request parameters. */ public filesAlphaUpload(arg: files.UploadArg): Promise<DropboxResponse<files.FileMetadata>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.RelocationError>. * @param arg The request parameters. */ public filesCopyV2(arg: files.RelocationArg): Promise<DropboxResponse<files.RelocationResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.RelocationError>. * @deprecated * @param arg The request parameters. */ public filesCopy(arg: files.RelocationArg): Promise<DropboxResponse<files.FileMetadataReference|files.FolderMetadataReference|files.DeletedMetadataReference>>; /** * Copy multiple files or folders to different locations at once in the * user's Dropbox. This route will replace copyBatch(). The main difference * is this route will return status for each entry, while copyBatch() 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 * copyBatchCheckV2() to check the job status. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. * @param arg The request parameters. */ public filesCopyBatchV2(arg: files.CopyBatchArg): Promise<DropboxResponse<files.RelocationBatchV2Launch>>; /** * 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 copyBatchCheck() to check the * job status. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. * @deprecated * @param arg The request parameters. */ public filesCopyBatch(arg: files.RelocationBatchArg): Promise<DropboxResponse<files.RelocationBatchLaunch>>; /** * Returns the status of an asynchronous job for copyBatchV2(). It returns * list of results for each entry. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<async.PollError>. * @param arg The request parameters. */ public filesCopyBatchCheckV2(arg: async.PollArg): Promise<DropboxResponse<files.RelocationBatchV2JobStatus>>; /** * Returns the status of an asynchronous job for copyBatch(). If success, it * returns list of results for each entry. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<async.PollError>. * @deprecated * @param arg The request parameters. */ public filesCopyBatchCheck(arg: async.PollArg): Promise<DropboxResponse<files.RelocationBatchJobStatus>>; /** * 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 copyReferenceSave(). * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.GetCopyReferenceError>. * @param arg The request parameters. */ public filesCopyReferenceGet(arg: files.GetCopyReferenceArg): Promise<DropboxResponse<files.GetCopyReferenceResult>>; /** * Save a copy reference returned by copyReferenceGet() to the user's * Dropbox. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.SaveCopyReferenceError>. * @param arg The request parameters. */ public filesCopyReferenceSave(arg: files.SaveCopyReferenceArg): Promise<DropboxResponse<files.SaveCopyReferenceResult>>; /** * Create a folder at a given path. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.CreateFolderError>. * @param arg The request parameters. */ public filesCreateFolderV2(arg: files.CreateFolderArg): Promise<DropboxResponse<files.CreateFolderResult>>; /** * Create a folder at a given path. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.CreateFolderError>. * @deprecated * @param arg The request parameters. */ public filesCreateFolder(arg: files.CreateFolderArg): Promise<DropboxResponse<files.FolderMetadata>>; /** * 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 * createFolderBatchCheck() to check the job status. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. * @param arg The request parameters. */ public filesCreateFolderBatch(arg: files.CreateFolderBatchArg): Promise<DropboxResponse<files.CreateFolderBatchLaunch>>; /** * Returns the status of an asynchronous job for createFolderBatch(). If * success, it returns list of result for each entry. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<async.PollError>. * @param arg The request parameters. */ public filesCreateFolderBatchCheck(arg: async.PollArg): Promise<DropboxResponse<files.CreateFolderBatchJobStatus>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.DeleteError>. * @param arg The request parameters. */ public filesDeleteV2(arg: files.DeleteArg): Promise<DropboxResponse<files.DeleteResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.DeleteError>. * @deprecated * @param arg The request parameters. */ public filesDelete(arg: files.DeleteArg): Promise<DropboxResponse<files.FileMetadataReference|files.FolderMetadataReference|files.DeletedMetadataReference>>; /** * Delete multiple files/folders at once. This route is asynchronous, which * returns a job ID immediately and runs the delete batch asynchronously. * Use deleteBatchCheck() to check the job status. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. * @param arg The request parameters. */ public filesDeleteBatch(arg: files.DeleteBatchArg): Promise<DropboxResponse<files.DeleteBatchLaunch>>; /** * Returns the status of an asynchronous job for deleteBatch(). If success, * it returns list of result for each entry. * * Route attributes: * scope: files.content.write * * When an error occurs, the route rejects the promise with type * DropboxResponseError<async.PollError>. * @param arg The request parameters. */ public filesDeleteBatchCheck(arg: async.PollArg): Promise<DropboxResponse<files.DeleteBatchJobStatus>>; /** * Download a file from a user's Dropbox. * * Route attributes: * scope: files.content.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.DownloadError>. * @param arg The request parameters. */ public filesDownload(arg: files.DownloadArg): Promise<DropboxResponse<files.FileMetadata>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.DownloadZipError>. * @param arg The request parameters. */ public filesDownloadZip(arg: files.DownloadZipArg): Promise<DropboxResponse<files.DownloadZipResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.ExportError>. * @param arg The request parameters. */ public filesExport(arg: files.ExportArg): Promise<DropboxResponse<files.ExportResult>>; /** * Return the lock metadata for the given list of paths. * * Route attributes: * scope: files.content.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.LockFileError>. * @param arg The request parameters. */ public filesGetFileLockBatch(arg: files.LockFileBatchArg): Promise<DropboxResponse<files.LockFileBatchResult>>; /** * Returns the metadata for a file or folder. Note: Metadata for the root * folder is unsupported. * * Route attributes: * scope: files.metadata.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.GetMetadataError>. * @param arg The request parameters. */ public filesGetMetadata(arg: files.GetMetadataArg): Promise<DropboxResponse<files.FileMetadataReference|files.FolderMetadataReference|files.DeletedMetadataReference>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.PreviewError>. * @param arg The request parameters. */ public filesGetPreview(arg: files.PreviewArg): Promise<DropboxResponse<files.FileMetadata>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.GetTemporaryLinkError>. * @param arg The request parameters. */ public filesGetTemporaryLink(arg: files.GetTemporaryLinkArg): Promise<DropboxResponse<files.GetTemporaryLinkResult>>; /** * 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 getTemporaryUploadLink() 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<void>. * @param arg The request parameters. */ public filesGetTemporaryUploadLink(arg: files.GetTemporaryUploadLinkArg): Promise<DropboxResponse<files.GetTemporaryUploadLinkResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.ThumbnailError>. * @param arg The request parameters. */ public filesGetThumbnail(arg: files.ThumbnailArg): Promise<DropboxResponse<files.FileMetadata>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.ThumbnailV2Error>. * @param arg The request parameters. */ public filesGetThumbnailV2(arg: files.ThumbnailV2Arg): Promise<DropboxResponse<files.PreviewResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.GetThumbnailBatchError>. * @param arg The request parameters. */ public filesGetThumbnailBatch(arg: files.GetThumbnailBatchArg): Promise<DropboxResponse<files.GetThumbnailBatchResult>>; /** * Starts returning the contents of a folder. If the result's * ListFolderResult.has_more field is true, call listFolderContinue() 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 listFolder() or listFolderContinue() 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.ListFolderError>. * @param arg The request parameters. */ public filesListFolder(arg: files.ListFolderArg): Promise<DropboxResponse<files.ListFolderResult>>; /** * Once a cursor has been retrieved from listFolder(), use this to paginate * through all files and retrieve updates to the folder, following the same * rules as documented for listFolder(). * * Route attributes: * scope: files.metadata.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.ListFolderContinueError>. * @param arg The request parameters. */ public filesListFolderContinue(arg: files.ListFolderContinueArg): Promise<DropboxResponse<files.ListFolderResult>>; /** * A way to quickly get a cursor for the folder's state. Unlike * listFolder(), listFolderGetLatestCursor() 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 * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.ListFolderError>. * @param arg The request parameters. */ public filesListFolderGetLatestCursor(arg: files.ListFolderArg): Promise<DropboxResponse<files.ListFolderGetLatestCursorResult>>; /** * A longpoll endpoint to wait for changes on an account. In conjunction * with listFolderContinue(), 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]{@link * https://www.dropbox.com/developers/reference/webhooks}. * * Route attributes: * scope: files.metadata.read * * When an error occurs, the route rejects the promise with type * DropboxResponseError<files.ListFolderLongpollError>. * @param arg The request parameters. */ public filesListFolderLongpoll(arg: files.ListFolderLongpollArg): Promise<DropboxResponse<files.ListFolderLongpollResult>>; /** * 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 * * When an error occurs, the route rejects the promise with type * DropboxRe