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,725 lines (1,474 loc) • 688 kB
TypeScript
declare module DropboxTypes {
interface DropboxOptions {
// An access token for making authenticated requests.
accessToken?: string;
// The client id for your app. Used to create authentication URL.
clientId?: string;
// Select user is only used by team endpoints. It specifies which user the team access token should be acting as.
selectUser?: string;
// Root path used to access namespaces different from home namespace (team folders etc)
pathRoot?: string;
// Fetch library for making requests.
fetch?: Function
}
class DropboxBase {
/**
* Get the 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.
*/
getAccessTokenFromCode(redirectUri: string, code: string): Promise<string>;
/**
* Get a URL that can be used to authenticate users for the Dropbox API.
* @param redirectUri A URL to redirect the user to after authenticating.
* This must be added to your app through the admin interface.
* @param state State that will be returned in the redirect URL to help
* prevent cross site scripting attacks.
*/
getAuthenticationUrl(redirectUri: string, state?: string, authType?: 'token' | 'code'): string;
/**
* Get the 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;
}
/**
* An Error object returned from a route.
*/
interface Error<T> {
// Text summary of the error.
error_summary: string;
// The error object.
error: T;
// User-friendly error message.
user_message: UserMessage;
}
/**
* User-friendly error message.
*/
interface UserMessage {
// The message.
text: string;
// The locale of the message.
locale: string;
}
type Timestamp = string;
namespace async {
/**
* The job finished synchronously and successfully.
*/
export interface LaunchEmptyResultComplete {
'.tag': 'complete';
}
/**
* Result returned by methods that may either launch an asynchronous job or
* complete synchronously. Upon synchronous completion of the job, no
* additional information is returned.
*/
export type LaunchEmptyResult = LaunchResultBase | LaunchEmptyResultComplete;
/**
* This response indicates that the processing is asynchronous. The string
* is an id that can be used to obtain the status of the asynchronous job.
*/
export interface LaunchResultBaseAsyncJobId {
'.tag': 'async_job_id';
async_job_id: AsyncJobId;
}
/**
* Result returned by methods that launch an asynchronous job. A method who
* may either launch an asynchronous job, or complete the request
* synchronously, can use this union by extending it, and adding a
* 'complete' field with the type of the synchronous response. See
* async.LaunchEmptyResult for an example.
*/
export type LaunchResultBase = LaunchResultBaseAsyncJobId;
/**
* Arguments for methods that poll the status of an asynchronous job.
*/
export interface PollArg {
/**
* Id of the asynchronous job. This is the value of a response returned
* from the method that launched the job.
*/
async_job_id: AsyncJobId;
}
/**
* The asynchronous job has completed successfully.
*/
export interface PollEmptyResultComplete {
'.tag': 'complete';
}
/**
* Result returned by methods that poll for the status of an asynchronous
* job. Upon completion of the job, no additional information is returned.
*/
export type PollEmptyResult = PollResultBase | PollEmptyResultComplete;
/**
* The job ID is invalid.
*/
export interface PollErrorInvalidAsyncJobId {
'.tag': 'invalid_async_job_id';
}
/**
* Something went wrong with the job on Dropbox's end. You'll need to verify
* that the action you were taking succeeded, and if not, try again. This
* should happen very rarely.
*/
export interface PollErrorInternalError {
'.tag': 'internal_error';
}
export interface PollErrorOther {
'.tag': 'other';
}
/**
* Error returned by methods for polling the status of asynchronous job.
*/
export type PollError = PollErrorInvalidAsyncJobId | PollErrorInternalError | PollErrorOther;
/**
* The asynchronous job is still in progress.
*/
export interface PollResultBaseInProgress {
'.tag': 'in_progress';
}
/**
* Result returned by methods that poll for the status of an asynchronous
* job. Unions that extend this union should add a 'complete' field with a
* type of the information returned upon job completion. See
* async.PollEmptyResult for an example.
*/
export type PollResultBase = PollResultBaseInProgress;
export type AsyncJobId = string;
}
namespace auth {
/**
* Current account type cannot access the resource.
*/
export interface AccessErrorInvalidAccountType {
'.tag': 'invalid_account_type';
invalid_account_type: InvalidAccountTypeError;
}
/**
* Current account cannot access Paper.
*/
export interface AccessErrorPaperAccessDenied {
'.tag': 'paper_access_denied';
paper_access_denied: PaperAccessError;
}
export interface AccessErrorOther {
'.tag': 'other';
}
/**
* Error occurred because the account doesn't have permission to access the
* resource.
*/
export type AccessError = AccessErrorInvalidAccountType | AccessErrorPaperAccessDenied | AccessErrorOther;
/**
* The access token is invalid.
*/
export interface AuthErrorInvalidAccessToken {
'.tag': 'invalid_access_token';
}
/**
* The user specified in 'Dropbox-API-Select-User' is no longer on the team.
*/
export interface AuthErrorInvalidSelectUser {
'.tag': 'invalid_select_user';
}
/**
* The user specified in 'Dropbox-API-Select-Admin' is not a Dropbox
* Business team admin.
*/
export interface AuthErrorInvalidSelectAdmin {
'.tag': 'invalid_select_admin';
}
/**
* The user has been suspended.
*/
export interface AuthErrorUserSuspended {
'.tag': 'user_suspended';
}
/**
* The access token has expired.
*/
export interface AuthErrorExpiredAccessToken {
'.tag': 'expired_access_token';
}
export interface AuthErrorOther {
'.tag': 'other';
}
/**
* Errors occurred during authentication.
*/
export type AuthError = AuthErrorInvalidAccessToken | AuthErrorInvalidSelectUser | AuthErrorInvalidSelectAdmin | AuthErrorUserSuspended | AuthErrorExpiredAccessToken | AuthErrorOther;
/**
* Current account type doesn't have permission to access this route
* endpoint.
*/
export interface InvalidAccountTypeErrorEndpoint {
'.tag': 'endpoint';
}
/**
* Current account type doesn't have permission to access this feature.
*/
export interface InvalidAccountTypeErrorFeature {
'.tag': 'feature';
}
export interface InvalidAccountTypeErrorOther {
'.tag': 'other';
}
export type InvalidAccountTypeError = InvalidAccountTypeErrorEndpoint | InvalidAccountTypeErrorFeature | InvalidAccountTypeErrorOther;
/**
* Paper is disabled.
*/
export interface PaperAccessErrorPaperDisabled {
'.tag': 'paper_disabled';
}
/**
* The provided user has not used Paper yet.
*/
export interface PaperAccessErrorNotPaperUser {
'.tag': 'not_paper_user';
}
export interface PaperAccessErrorOther {
'.tag': 'other';
}
export type PaperAccessError = PaperAccessErrorPaperDisabled | PaperAccessErrorNotPaperUser | PaperAccessErrorOther;
/**
* Error occurred because the app is being rate limited.
*/
export interface RateLimitError {
/**
* The reason why the app is being rate limited.
*/
reason: RateLimitReason;
/**
* Defaults to 1.
*/
retry_after?: number;
}
/**
* You are making too many requests in the past few minutes.
*/
export interface RateLimitReasonTooManyRequests {
'.tag': 'too_many_requests';
}
/**
* There are currently too many write operations happening in the user's
* Dropbox.
*/
export interface RateLimitReasonTooManyWriteOperations {
'.tag': 'too_many_write_operations';
}
export interface RateLimitReasonOther {
'.tag': 'other';
}
export type RateLimitReason = RateLimitReasonTooManyRequests | RateLimitReasonTooManyWriteOperations | RateLimitReasonOther;
export interface TokenFromOAuth1Arg {
/**
* The supplied OAuth 1.0 access token.
*/
oauth1_token: string;
/**
* The token secret associated with the supplied access token.
*/
oauth1_token_secret: string;
}
/**
* Part or all of the OAuth 1.0 access token info is invalid.
*/
export interface TokenFromOAuth1ErrorInvalidOauth1TokenInfo {
'.tag': 'invalid_oauth1_token_info';
}
/**
* The authorized app does not match the app associated with the supplied
* access token.
*/
export interface TokenFromOAuth1ErrorAppIdMismatch {
'.tag': 'app_id_mismatch';
}
export interface TokenFromOAuth1ErrorOther {
'.tag': 'other';
}
export type TokenFromOAuth1Error = TokenFromOAuth1ErrorInvalidOauth1TokenInfo | TokenFromOAuth1ErrorAppIdMismatch | TokenFromOAuth1ErrorOther;
export interface TokenFromOAuth1Result {
/**
* The OAuth 2.0 token generated from the supplied OAuth 1.0 token.
*/
oauth2_token: string;
}
}
namespace common {
/**
* Paths are relative to the authenticating user's home namespace, whether
* or not that user belongs to a team.
*/
export interface PathRootHome {
'.tag': 'home';
}
/**
* Paths are relative to the authenticating user's root namespace (This
* results in PathRootError.invalid_root if the user's root namespace has
* changed.).
*/
export interface PathRootRoot {
'.tag': 'root';
root: NamespaceId;
}
/**
* Paths are relative to given namespace id (This results in
* PathRootError.no_permission if you don't have access to this namespace.).
*/
export interface PathRootNamespaceId {
'.tag': 'namespace_id';
namespace_id: NamespaceId;
}
export interface PathRootOther {
'.tag': 'other';
}
export type PathRoot = PathRootHome | PathRootRoot | PathRootNamespaceId | PathRootOther;
/**
* The root namespace id in Dropbox-API-Path-Root header is not valid. The
* value of this error is use's latest root info.
*/
export interface PathRootErrorInvalidRoot {
'.tag': 'invalid_root';
invalid_root: TeamRootInfoReference|UserRootInfoReference|RootInfoReference;
}
/**
* You don't have permission to access the namespace id in
* Dropbox-API-Path-Root header.
*/
export interface PathRootErrorNoPermission {
'.tag': 'no_permission';
}
export interface PathRootErrorOther {
'.tag': 'other';
}
export type PathRootError = PathRootErrorInvalidRoot | PathRootErrorNoPermission | PathRootErrorOther;
/**
* Information about current user's root.
*/
export interface RootInfo {
/**
* The namespace ID for user's root namespace. It will be the namespace ID
* of the shared team root if the user is member of a team with a separate
* team root. Otherwise it will be same as RootInfo.home_namespace_id.
*/
root_namespace_id: NamespaceId;
/**
* The namespace ID for user's home namespace.
*/
home_namespace_id: NamespaceId;
}
/**
* Reference to the RootInfo polymorphic type. Contains a .tag property to
* let you discriminate between possible subtypes.
*/
export interface RootInfoReference extends RootInfo {
/**
* Tag identifying the subtype variant.
*/
'.tag': "team"|"user";
}
/**
* Root info when user is member of a team with a separate root namespace
* ID.
*/
export interface TeamRootInfo extends RootInfo {
/**
* The path for user's home directory under the shared team root.
*/
home_path: string;
}
/**
* Reference to the TeamRootInfo type, identified by the value of the .tag
* property.
*/
export interface TeamRootInfoReference extends TeamRootInfo {
/**
* Tag identifying this subtype variant. This field is only present when
* needed to discriminate between multiple possible subtypes.
*/
'.tag': 'team';
}
/**
* Root info when user is not member of a team or the user is a member of a
* team and the team does not have a separate root namespace.
*/
export interface UserRootInfo extends RootInfo {
}
/**
* Reference to the UserRootInfo type, identified by the value of the .tag
* property.
*/
export interface UserRootInfoReference extends UserRootInfo {
/**
* Tag identifying this subtype variant. This field is only present when
* needed to discriminate between multiple possible subtypes.
*/
'.tag': 'user';
}
export type Date = Timestamp;
export type DisplayName = string;
export type DisplayNameLegacy = string;
export type DropboxTimestamp = Timestamp;
export type EmailAddress = string;
export type LanguageCode = string;
export type NamePart = string;
export type NamespaceId = string;
export type OptionalNamePart = string;
export type SessionId = string;
export type SharedFolderId = NamespaceId;
}
namespace contacts {
export interface DeleteManualContactsArg {
/**
* List of manually added contacts to be deleted.
*/
email_addresses: Array<common.EmailAddress>;
}
/**
* Can't delete contacts from this list. Make sure the list only has
* manually added contacts. The deletion was cancelled.
*/
export interface DeleteManualContactsErrorContactsNotFound {
'.tag': 'contacts_not_found';
contacts_not_found: Array<common.EmailAddress>;
}
export interface DeleteManualContactsErrorOther {
'.tag': 'other';
}
export type DeleteManualContactsError = DeleteManualContactsErrorContactsNotFound | DeleteManualContactsErrorOther;
}
/**
* This namespace contains helpers for property and template metadata
* endpoints. These endpoints enable you to tag arbitrary key/value data to
* Dropbox files. The most basic unit in this namespace is the
* file_properties.PropertyField. These fields encapsulate the actual
* key/value data. Fields are added to a Dropbox file using a
* file_properties.PropertyGroup. Property groups contain a reference to a
* Dropbox file and a file_properties.PropertyGroupTemplate. Property groups
* are uniquely identified by the combination of their associated Dropbox file
* and template. The file_properties.PropertyGroupTemplate is a way of
* restricting the possible key names and value types of the data within a
* property group. The possible key names and value types are explicitly
* enumerated using file_properties.PropertyFieldTemplate objects. You can
* think of a property group template as a class definition for a particular
* key/value metadata object, and the property groups themselves as the
* instantiations of these objects. Templates are owned either by a user/app
* pair or team/app pair. Templates and their associated properties can't be
* accessed by any app other than the app that created them, and even then,
* only when the app is linked with the owner of the template (either a user
* or team). User-owned templates are accessed via the user-auth
* file_properties/templates/*_for_user endpoints, while team-owned templates
* are accessed via the team-auth file_properties/templates/*_for_team
* endpoints. Properties associated with either type of template can be
* accessed via the user-auth properties/* endpoints. Finally, properties can
* be accessed from a number of endpoints that return metadata, including
* `files/get_metadata`, and `files/list_folder`. Properties can also be added
* during upload, using `files/upload`.
*/
namespace file_properties {
export interface AddPropertiesArg {
/**
* A unique identifier for the file or folder.
*/
path: PathOrId;
/**
* The property groups which are to be added to a Dropbox file.
*/
property_groups: Array<PropertyGroup>;
}
/**
* A property group associated with this template and file already exists.
*/
export interface AddPropertiesErrorPropertyGroupAlreadyExists {
'.tag': 'property_group_already_exists';
}
export type AddPropertiesError = InvalidPropertyGroupError | AddPropertiesErrorPropertyGroupAlreadyExists;
export interface AddTemplateArg extends PropertyGroupTemplate {
}
export interface AddTemplateResult {
/**
* An identifier for template added by See templatesAddForUser() or
* templatesAddForTeam().
*/
template_id: TemplateId;
}
export interface GetTemplateArg {
/**
* An identifier for template added by route See templatesAddForUser() or
* templatesAddForTeam().
*/
template_id: TemplateId;
}
export interface GetTemplateResult extends PropertyGroupTemplate {
}
/**
* One or more of the supplied property field values is too large.
*/
export interface InvalidPropertyGroupErrorPropertyFieldTooLarge {
'.tag': 'property_field_too_large';
}
/**
* One or more of the supplied property fields does not conform to the
* template specifications.
*/
export interface InvalidPropertyGroupErrorDoesNotFitTemplate {
'.tag': 'does_not_fit_template';
}
export type InvalidPropertyGroupError = PropertiesError | InvalidPropertyGroupErrorPropertyFieldTooLarge | InvalidPropertyGroupErrorDoesNotFitTemplate;
export interface ListTemplateResult {
/**
* List of identifiers for templates added by See templatesAddForUser()
* or templatesAddForTeam().
*/
template_ids: Array<TemplateId>;
}
/**
* Append a query with an "or" operator.
*/
export interface LogicalOperatorOrOperator {
'.tag': 'or_operator';
}
export interface LogicalOperatorOther {
'.tag': 'other';
}
/**
* Logical operator to join search queries together.
*/
export type LogicalOperator = LogicalOperatorOrOperator | LogicalOperatorOther;
/**
* No property group was found.
*/
export interface LookUpPropertiesErrorPropertyGroupNotFound {
'.tag': 'property_group_not_found';
}
export interface LookUpPropertiesErrorOther {
'.tag': 'other';
}
export type LookUpPropertiesError = LookUpPropertiesErrorPropertyGroupNotFound | LookUpPropertiesErrorOther;
export interface LookupErrorMalformedPath {
'.tag': 'malformed_path';
malformed_path: string;
}
/**
* There is nothing at the given path.
*/
export interface LookupErrorNotFound {
'.tag': 'not_found';
}
/**
* We were expecting a file, but the given path refers to something that
* isn't a file.
*/
export interface LookupErrorNotFile {
'.tag': 'not_file';
}
/**
* We were expecting a folder, but the given path refers to something that
* isn't a folder.
*/
export interface LookupErrorNotFolder {
'.tag': 'not_folder';
}
/**
* The file cannot be transferred because the content is restricted. For
* example, sometimes there are legal restrictions due to copyright claims.
*/
export interface LookupErrorRestrictedContent {
'.tag': 'restricted_content';
}
export interface LookupErrorOther {
'.tag': 'other';
}
export type LookupError = LookupErrorMalformedPath | LookupErrorNotFound | LookupErrorNotFile | LookupErrorNotFolder | LookupErrorRestrictedContent | LookupErrorOther;
/**
* A property field key with that name already exists in the template.
*/
export interface ModifyTemplateErrorConflictingPropertyNames {
'.tag': 'conflicting_property_names';
}
/**
* There are too many properties in the changed template. The maximum number
* of properties per template is 32.
*/
export interface ModifyTemplateErrorTooManyProperties {
'.tag': 'too_many_properties';
}
/**
* There are too many templates for the team.
*/
export interface ModifyTemplateErrorTooManyTemplates {
'.tag': 'too_many_templates';
}
/**
* The template name, description or one or more of the property field keys
* is too large.
*/
export interface ModifyTemplateErrorTemplateAttributeTooLarge {
'.tag': 'template_attribute_too_large';
}
export type ModifyTemplateError = TemplateError | ModifyTemplateErrorConflictingPropertyNames | ModifyTemplateErrorTooManyProperties | ModifyTemplateErrorTooManyTemplates | ModifyTemplateErrorTemplateAttributeTooLarge;
export interface OverwritePropertyGroupArg {
/**
* A unique identifier for the file or folder.
*/
path: PathOrId;
/**
* The property groups "snapshot" updates to force apply.
*/
property_groups: Array<PropertyGroup>;
}
export interface PropertiesErrorPath {
'.tag': 'path';
path: LookupError;
}
/**
* This folder cannot be tagged. Tagging folders is not supported for
* team-owned templates.
*/
export interface PropertiesErrorUnsupportedFolder {
'.tag': 'unsupported_folder';
}
export type PropertiesError = TemplateError | PropertiesErrorPath | PropertiesErrorUnsupportedFolder;
export interface PropertiesSearchArg {
/**
* Queries to search.
*/
queries: Array<PropertiesSearchQuery>;
/**
* Defaults to TagRef(Union(u'TemplateFilter', [UnionField(u'filter_none',
* Void, False, None)]), u'filter_none').
*/
template_filter?: TemplateFilter;
}
export interface PropertiesSearchContinueArg {
/**
* The cursor returned by your last call to propertiesSearch() or
* propertiesSearchContinue().
*/
cursor: PropertiesSearchCursor;
}
/**
* Indicates that the cursor has been invalidated. Call propertiesSearch()
* to obtain a new cursor.
*/
export interface PropertiesSearchContinueErrorReset {
'.tag': 'reset';
}
export interface PropertiesSearchContinueErrorOther {
'.tag': 'other';
}
export type PropertiesSearchContinueError = PropertiesSearchContinueErrorReset | PropertiesSearchContinueErrorOther;
export interface PropertiesSearchErrorPropertyGroupLookup {
'.tag': 'property_group_lookup';
property_group_lookup: LookUpPropertiesError;
}
export interface PropertiesSearchErrorOther {
'.tag': 'other';
}
export type PropertiesSearchError = PropertiesSearchErrorPropertyGroupLookup | PropertiesSearchErrorOther;
export interface PropertiesSearchMatch {
/**
* The ID for the matched file or folder.
*/
id: Id;
/**
* The path for the matched file or folder.
*/
path: string;
/**
* Whether the file or folder is deleted.
*/
is_deleted: boolean;
/**
* List of custom property groups associated with the file.
*/
property_groups: Array<PropertyGroup>;
}
/**
* Search for a value associated with this field name.
*/
export interface PropertiesSearchModeFieldName {
'.tag': 'field_name';
field_name: string;
}
export interface PropertiesSearchModeOther {
'.tag': 'other';
}
export type PropertiesSearchMode = PropertiesSearchModeFieldName | PropertiesSearchModeOther;
export interface PropertiesSearchQuery {
/**
* The property field value for which to search across templates.
*/
query: string;
/**
* The mode with which to perform the search.
*/
mode: PropertiesSearchMode;
/**
* Defaults to TagRef(Union(u'LogicalOperator',
* [UnionField(u'or_operator', Void, False, None), UnionField(u'other',
* Void, True, None)]), u'or_operator').
*/
logical_operator?: LogicalOperator;
}
export interface PropertiesSearchResult {
/**
* A list (possibly empty) of matches for the query.
*/
matches: Array<PropertiesSearchMatch>;
/**
* Pass the cursor into propertiesSearchContinue() to continue to receive
* search results. Cursor will be null when there are no more results.
*/
cursor?: PropertiesSearchCursor;
}
/**
* Raw key/value data to be associated with a Dropbox file. Property fields
* are added to Dropbox files as a file_properties.PropertyGroup.
*/
export interface PropertyField {
/**
* Key of the property field associated with a file and template. Keys can
* be up to 256 bytes.
*/
name: string;
/**
* Value of the property field associated with a file and template. Values
* can be up to 1024 bytes.
*/
value: string;
}
/**
* Defines how a single property field may be structured. Used exclusively
* by file_properties.PropertyGroupTemplate.
*/
export interface PropertyFieldTemplate {
/**
* Key of the property field being described. Property field keys can be
* up to 256 bytes.
*/
name: string;
/**
* Description of the property field. Property field descriptions can be
* up to 1024 bytes.
*/
description: string;
/**
* Data type of the value of this property field. This type will be
* enforced upon property creation and modifications.
*/
type: PropertyType;
}
/**
* A subset of the property fields described by the corresponding
* file_properties.PropertyGroupTemplate. Properties are always added to a
* Dropbox file as a file_properties.PropertyGroup. The possible key names
* and value types in this group are defined by the corresponding
* file_properties.PropertyGroupTemplate.
*/
export interface PropertyGroup {
/**
* A unique identifier for the associated template.
*/
template_id: TemplateId;
/**
* The actual properties associated with the template. There can be up to
* 32 property types per template.
*/
fields: Array<PropertyField>;
}
/**
* Defines how a property group may be structured.
*/
export interface PropertyGroupTemplate {
/**
* Display name for the template. Template names can be up to 256 bytes.
*/
name: string;
/**
* Description for the template. Template descriptions can be up to 1024
* bytes.
*/
description: string;
/**
* Definitions of the property fields associated with this template. There
* can be up to 32 properties in a single template.
*/
fields: Array<PropertyFieldTemplate>;
}
export interface PropertyGroupUpdate {
/**
* A unique identifier for a property template.
*/
template_id: TemplateId;
/**
* Property fields to update. If the property field already exists, it is
* updated. If the property field doesn't exist, the property group is
* added.
*/
add_or_update_fields?: Array<PropertyField>;
/**
* Property fields to remove (by name), provided they exist.
*/
remove_fields?: Array<string>;
}
/**
* The associated property field will be of type string. Unicode is
* supported.
*/
export interface PropertyTypeString {
'.tag': 'string';
}
export interface PropertyTypeOther {
'.tag': 'other';
}
/**
* Data type of the given property field added.
*/
export type PropertyType = PropertyTypeString | PropertyTypeOther;
export interface RemovePropertiesArg {
/**
* A unique identifier for the file or folder.
*/
path: PathOrId;
/**
* A list of identifiers for a template created by templatesAddForUser()
* or templatesAddForTeam().
*/
property_template_ids: Array<TemplateId>;
}
export interface RemovePropertiesErrorPropertyGroupLookup {
'.tag': 'property_group_lookup';
property_group_lookup: LookUpPropertiesError;
}
export type RemovePropertiesError = PropertiesError | RemovePropertiesErrorPropertyGroupLookup;
export interface RemoveTemplateArg {
/**
* An identifier for a template created by templatesAddForUser() or
* templatesAddForTeam().
*/
template_id: TemplateId;
}
/**
* Template does not exist for the given identifier.
*/
export interface TemplateErrorTemplateNotFound {
'.tag': 'template_not_found';
template_not_found: TemplateId;
}
/**
* You do not have permission to modify this template.
*/
export interface TemplateErrorRestrictedContent {
'.tag': 'restricted_content';
}
export interface TemplateErrorOther {
'.tag': 'other';
}
export type TemplateError = TemplateErrorTemplateNotFound | TemplateErrorRestrictedContent | TemplateErrorOther;
/**
* No templates will be filtered from the result (all templates will be
* returned).
*/
export interface TemplateFilterFilterNone {
'.tag': 'filter_none';
}
export type TemplateFilter = TemplateFilterBase | TemplateFilterFilterNone;
/**
* Only templates with an ID in the supplied list will be returned (a subset
* of templates will be returned).
*/
export interface TemplateFilterBaseFilterSome {
'.tag': 'filter_some';
filter_some: Array<TemplateId>;
}
export interface TemplateFilterBaseOther {
'.tag': 'other';
}
export type TemplateFilterBase = TemplateFilterBaseFilterSome | TemplateFilterBaseOther;
/**
* Template will be associated with a user.
*/
export interface TemplateOwnerTypeUser {
'.tag': 'user';
}
/**
* Template will be associated with a team.
*/
export interface TemplateOwnerTypeTeam {
'.tag': 'team';
}
export interface TemplateOwnerTypeOther {
'.tag': 'other';
}
export type TemplateOwnerType = TemplateOwnerTypeUser | TemplateOwnerTypeTeam | TemplateOwnerTypeOther;
export interface UpdatePropertiesArg {
/**
* A unique identifier for the file or folder.
*/
path: PathOrId;
/**
* The property groups "delta" updates to apply.
*/
update_property_groups: Array<PropertyGroupUpdate>;
}
export interface UpdatePropertiesErrorPropertyGroupLookup {
'.tag': 'property_group_lookup';
property_group_lookup: LookUpPropertiesError;
}
export type UpdatePropertiesError = InvalidPropertyGroupError | UpdatePropertiesErrorPropertyGroupLookup;
export interface UpdateTemplateArg {
/**
* An identifier for template added by See templatesAddForUser() or
* templatesAddForTeam().
*/
template_id: TemplateId;
/**
* A display name for the template. template names can be up to 256 bytes.
*/
name?: string;
/**
* Description for the new template. Template descriptions can be up to
* 1024 bytes.
*/
description?: string;
/**
* Property field templates to be added to the group template. There can
* be up to 32 properties in a single template.
*/
add_fields?: Array<PropertyFieldTemplate>;
}
export interface UpdateTemplateResult {
/**
* An identifier for template added by route See templatesAddForUser() or
* templatesAddForTeam().
*/
template_id: TemplateId;
}
export type Id = string;
export type PathOrId = string;
export type PropertiesSearchCursor = string;
export type TemplateId = string;
}
/**
* This namespace contains endpoints and data types for file request
* operations.
*/
namespace file_requests {
/**
* Arguments for create().
*/
export interface CreateFileRequestArgs {
/**
* The title of the file request. Must not be empty.
*/
title: string;
/**
* The path of the folder in the Dropbox where uploaded files will be
* sent. For apps with the app folder permission, this will be relative to
* the app folder.
*/
destination: files.Path;
/**
* The deadline for the file request. Deadlines can only be set by
* Professional and Business accounts.
*/
deadline?: FileRequestDeadline;
/**
* Defaults to True.
*/
open?: boolean;
}
/**
* File requests are not available on the specified folder.
*/
export interface CreateFileRequestErrorInvalidLocation {
'.tag': 'invalid_location';
}
/**
* The user has reached the rate limit for creating file requests. The limit
* is currently 100 file requests per day.
*/
export interface CreateFileRequestErrorRateLimit {
'.tag': 'rate_limit';
}
/**
* There was an error creating the file request.
*/
export type CreateFileRequestError = FileRequestError | CreateFileRequestErrorInvalidLocation | CreateFileRequestErrorRateLimit;
/**
* A [file request]{@link https://www.dropbox.com/help/9090} for receiving
* files into the user's Dropbox account.
*/
export interface FileRequest {
/**
* The ID of the file request.
*/
id: FileRequestId;
/**
* The URL of the file request.
*/
url: string;
/**
* The title of the file request.
*/
title: string;
/**
* The path of the folder in the Dropbox where uploaded files will be
* sent. This can be null if the destination was removed. For apps with
* the app folder permission, this will be relative to the app folder.
*/
destination?: files.Path;
/**
* When this file request was created.
*/
created: common.DropboxTimestamp;
/**
* The deadline for this file request. Only set if the request has a
* deadline.
*/
deadline?: FileRequestDeadline;
/**
* Whether or not the file request is open. If the file request is closed,
* it will not accept any more file submissions.
*/
is_open: boolean;
/**
* The number of files this file request has received.
*/
file_count: number;
}
export interface FileRequestDeadline {
/**
* The deadline for this file request.
*/
deadline: common.DropboxTimestamp;
/**
* If set, allow uploads after the deadline has passed. These uploads
* will be marked overdue.
*/
allow_late_uploads?: GracePeriod;
}
/**
* This file request ID was not found.
*/
export interface FileRequestErrorNotFound {
'.tag': 'not_found';
}
/**
* The specified path is not a folder.
*/
export interface FileRequestErrorNotAFolder {
'.tag': 'not_a_folder';
}
/**
* This file request is not accessible to this app. Apps with the app folder
* permission can only access file requests in their app folder.
*/
export interface FileRequestErrorAppLacksAccess {
'.tag': 'app_lacks_access';
}
/**
* This user doesn't have permission to access or modify this file request.
*/
export interface FileRequestErrorNoPermission {
'.tag': 'no_permission';
}
/**
* This user's email address is not verified. File requests are only
* available on accounts with a verified email address. Users can verify
* their email address [here]{@link https://www.dropbox.com/help/317}.
*/
export interface FileRequestErrorEmailUnverified {
'.tag': 'email_unverified';
}
/**
* There was an error validating the request. For example, the title was
* invalid, or there were disallowed characters in the destination path.
*/
export interface FileRequestErrorValidationError {
'.tag': 'validation_error';
}
/**
* There is an error with the file request.
*/
export type FileRequestError = GeneralFileRequestsError | FileRequestErrorNotFound | FileRequestErrorNotAFolder | FileRequestErrorAppLacksAccess | FileRequestErrorNoPermission | FileRequestErrorEmailUnverified | FileRequestErrorValidationError;
/**
* This user's Dropbox Business team doesn't allow file requests.
*/
export interface GeneralFileRequestsErrorDisabledForTeam {
'.tag': 'disabled_for_team';
}
export interface GeneralFileRequestsErrorOther {
'.tag': 'other';
}
/**
* There is an error accessing the file requests functionality.
*/
export type GeneralFileRequestsError = GeneralFileRequestsErrorDisabledForTeam | GeneralFileRequestsErrorOther;
/**
* Arguments for get().
*/
export interface GetFileRequestArgs {
/**
* The ID of the file request to retrieve.
*/
id: FileRequestId;
}
/**
* There was an error retrieving the specified file request.
*/
export type GetFileRequestError = FileRequestError;
export interface GracePeriodOneDay {
'.tag': 'one_day';
}
export interface GracePeriodTwoDays {
'.tag': 'two_days';
}
export interface GracePeriodSevenDays {
'.tag': 'seven_days';
}
export interface GracePeriodThirtyDays {
'.tag': 'thirty_days';
}
export interface GracePeriodAlways {
'.tag': 'always';
}
export interface GracePeriodOther {
'.tag': 'other';
}
export type GracePeriod = GracePeriodOneDay | GracePeriodTwoDays | GracePeriodSevenDays | GracePeriodThirtyDays | GracePeriodAlways | GracePeriodOther;
/**
* There was an error retrieving the file requests.
*/
export type ListFileRequestsError = GeneralFileRequestsError;
/**
* Result for list().
*/
export interface ListFileRequestsResult {
/**
* The file requests owned by this user. Apps with the app folder
* permission will only see file requests in their app folder.
*/
file_requests: Array<FileRequest>;
}
/**
* Arguments for update().
*/
export interface UpdateFileRequestArgs {
/**
* The ID of the file request to update.
*/
id: FileRequestId;
/**
* The new title of the file request. Must not be empty.
*/
title?: string;
/**
* The new path of the folder in the Dropbox where uploaded files will be
* sent. For apps with the app folder permission, this will be relative to
* the app folder.
*/
destination?: files.Path;
/**
* Defaults to TagRef(Union(u'UpdateFileRequestDeadline',
* [UnionField(u'no_update', Void, False, None), UnionField(u'update',
* Nullable, False, None), UnionField(u'other', Void, True, None)]),
* u'no_update').
*/
deadline?: UpdateFileRequestDeadline;
/**
* Whether to set this file request as open or closed.
*/
open?: boolean;
}
/**
* Do not change the file request's deadline.
*/
export interface UpdateFileRequestDeadlineNoUpdate {
'.tag': 'no_update';
}
/**
* If null, the file request's deadline is cleared.
*/
export interface UpdateFileRequestDeadlineUpdate {
'.tag': 'update';
update: Object;
}
export interface UpdateFileRequestDeadlineOther {
'.tag': 'other';
}
export type UpdateFileRequestDeadline = UpdateFileRequestDeadlineNoUpdate | UpdateFileRequestDeadlineUpdate | UpdateFileRequestDeadlineOther;
/**
* There is an error updating the file request.
*/
export type UpdateFileRequestError = FileRequestError;
export type FileRequestId = string;
export type FileRequestValidationError = Object;
}
/**
* This namespace contains endpoints and data types for basic file operations.
*/
namespace files {
export interface AlphaGetMetadataArg extends GetMetadataArg {
/**
* If set to a valid list of template IDs, FileMetadata.property_groups is
* set for files with custom properties.
*/
include_property_templates?: Array<file_properties.TemplateId>;
}
export interface AlphaGetMetadataErrorPropertiesError {
'.tag': 'properties_error';
properties_error: file_properties.LookUpPropertiesError;
}
export type AlphaGetMetadataError = GetMetadataError | AlphaGetMetadataErrorPropertiesError;
export interface CommitInfo {
/**
* The file contents to be uploaded.
*/
contents: Object;
/**
* Path in the user's Dropbox to save the file.
*/
path: WritePathOrId;
/**
* Defaults to TagRef(Union(u'WriteMode', [UnionField(u'add', Void, False,
* None), UnionField(u'overwrite', Void, False, None),
* UnionField(u'update', Alias(u'Rev', String), False, None)]), u'add').
*/
mode?: WriteMode;
/**
* Defaults to False.
*/
autorename?: boolean;
/**
* The value to store as the client_modified timestamp. Dropbox
* automatically records the time at which the file was written to the
* Dropbox servers. It can also record an additional timestamp, provided
* by Dropbox desktop clients, mobile clients, and API apps of when the
* file was actually created or modified.
*/
client_modified?: common.DropboxTimestamp;
/**
* Defaults to False.
*/
mute?: boolean;
/**
* List of custom properties to add to file.
*/
property_groups?: Array<file_properties.PropertyGroup>;
/**
* Defaults to False.
*/
strict_conflict?: boolean;
}
export interface CommitInfoWithProperties extends CommitInfo {
/**
* The file contents to be uploaded.
*/
contents: Object;
}
export interface ContentSyncSetting {
/**
* Id of the item this setting is applied to.
*/
id: FileId;
/**
* Setting for this item.
*/
sync_setting: SyncSetting;
}
export interface ContentSyncSettingArg {
/**
* Id of the item this setting is applied to.
*/
id: FileId;
/**
* Setting for this item.
*/
sync_setting: SyncSettingArg;
}
export interface CreateFolderArg {
/**
* Path in the user's Dropbox to create.
*/
path: WritePath;
/**
* Defaults to False.
*/
autorename?: boolean;
}
export interface CreateFolderBatchArg {
/**
* List of paths to be created in the user's Dropbox. Duplicate path
* arguments in the batch are considered only once.
*/
paths: Array<WritePath>;
/**
* Defaults to False.
*/
autorename?: boolean;
/**
* Defaults to False.
*/
force_async?: boolean;
}
/**
* The operation would involve too many files or folders.
*/
export interface CreateFolderBatchErrorTooManyFiles {
'.tag': 'too_many_files';
}
export interface CreateFolderBatchErrorOther {
'.tag': 'other';
}
export type CreateFolderBatchError = CreateFolderBatchErrorTooManyFiles | CreateFolderBatchErrorOther;
/**
* The batch create folder has finished.
*/
export interface CreateFolderBatchJobStatusComplete extends CreateFolderBatchResult {
'.tag': 'complete';
}
/**
* The batch create folder has failed.
*/
export interface CreateFolderBatchJobStatusFailed {
'.tag': 'failed';
failed: CreateFolderBatchError;
}
export interface CreateFolderBatchJobStatusOther {
'.tag': 'other';
}
export type CreateFolderBatchJobStatus = async.PollResultBase | CreateFolderBatchJobStatusComplete | CreateFolderBatchJobStatusFailed | CreateFolderBatchJobStatusOther;
export interface CreateFolderBatchLaunchComplete extends CreateFolderBatchResult {
'.tag': 'complete';
}
export interface CreateFolderBatchLaunchOther {
'.tag': 'other';
}
/**
* Result returned by createFolderBatch() that may either launch an
* asynchronous job or complete synchronously.
*/
export type CreateFolderBatchLaunch = async.LaunchResultBase | CreateFolderBatchLaunchComplete | CreateFolderBatchLaunchOther;
export interface CreateFolderBatchResult extends FileOpsResult {
/**
* Each entry in CreateFolderBatchArg.paths will appear at the same
* position inside CreateFolderBatchResult.entries.
*/
entries: Array<CreateFolderBatchResultEntry>;
}
export interface CreateFolderBatchResultEntrySuccess extends CreateFolderEntryResult {
'.tag': 'success';
}
export interface CreateFolderBatchResultEntryFailure {
'.tag': 'failure';
failure: CreateFolderEntryError;
}
export type CreateFolderBatchResultEntry = CreateFolderBatchResultEntrySuccess | CreateFolderBatchResultEntryFailure;
export interface CreateFolderEntryErrorPath {
'.tag': 'path';
path: WriteError;
}
export interface CreateFolderEntryErrorOther {
'.tag': 'other';
}
export type CreateFolderEntryError = CreateFolderEntryErrorPath | CreateFolderEntryErrorOther;
export interface CreateFolderEntryResult {
/**
* Metadata of the created folder.
*/
metadata: FolderMetadata;
}
export interface CreateFolderErrorPath {
'.tag': 'path';
path: WriteError;
}
export type CreateFolderError = CreateFolderErrorPath;
export interface CreateFolderResult extends FileOpsResult {
/**
* Metadata of the created folder.
*/
metadata: FolderMetadata;
}
export interface DeleteArg {
/**
* Path in the user's Dropbox to delete.
*/
path: WritePathOrId;
/**
* Perform delete if given "rev" matches the existing file's latest "rev".
* This field does not support deleting a folder.
*/
parent_rev?: Rev;
}
export interface DeleteBatchArg {
entries: Array<DeleteArg>;
}
/**
* Use DeleteError.too_many_write_operations. deleteBatch() now provides
* smaller granularity about which entry has failed because of this.
*/
export interface DeleteBatchErrorTooManyWriteOperations {
'.tag': 'too_many_write_operations';
}
export interface DeleteBatchErrorOther {
'.tag': 'other';
}
export type DeleteBatchError = DeleteBatchErrorTooManyWriteOperations | DeleteBatchErrorOther;
/**
* The batch delete has finished.
*/
export interface DeleteBatchJobStatusComplete extends DeleteBatchResult {
'.tag': 'complete';
}
/**
* The batch delete has failed.
*/
export interface DeleteBatchJobStatusFailed {
'.tag': 'failed';
failed: DeleteBatchError;
}
export interface DeleteBatchJobStatusOther {
'.tag': 'other';
}
export type DeleteBatchJobStatus = async.PollResultBase | DeleteBatchJobStatusComplete | DeleteBatchJobStatusFailed | DeleteBatchJobStatusOther;
export interface DeleteBatchLaunchComplete extends DeleteBatchResult {
'.tag': 'complete';
}
export interface DeleteBatchLaunchOther {
'.tag': 'other';
}
/**
* Result returned by deleteBatch() that may either launch an asynchronous
* job or complete synchronously.
*/
export type DeleteBatchLaunch = async.LaunchResultBase | DeleteBatchLaunchComplete | DeleteBatchLaunchOther;
export interface DeleteBatchResult extends FileOpsResult {
/**
* Each entry in DeleteBatchArg.entries will appear at the same position
* inside DeleteBatchResult.entries.
*/
entries: Arra