Skip to content

Commit cf7ea0f

Browse files
DropboxBotBrent Bumann
andauthored
Automated Spec Update (#905)
895e08a3fa941888c2c57681c8117a294f8fa4b9 Change Notes: common Namespace - Update comments files Namespace - Add UploadArg extends CommitInfo structs - Add UploadSessionAppendError extends UploadSessionLookupError unions - Remove CommitInfoWithProperties extends CommitInfo structs - Remove UploadErrorWithProperties extends UploadError unions Co-authored-by: DropboxBot <DropboxBot@users.noreply.github.com> Co-authored-by: Brent Bumann <bbumann@dropbox.com>
1 parent 62b8dcc commit cf7ea0f

File tree

7 files changed

+145
-74
lines changed

7 files changed

+145
-74
lines changed

generator/dropbox-api-spec

lib/routes.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,16 +434,16 @@ routes.filesAlphaGetMetadata = function (arg) {
434434
};
435435

436436
/**
437-
* Create a new file with the contents provided in the request. Note that this
438-
* endpoint is part of the properties API alpha and is slightly different from
439-
* upload. Do not use this to upload a file larger than 150 MB. Instead, create
440-
* an upload session with upload_session/start.
437+
* Create a new file with the contents provided in the request. Note that the
438+
* behavior of this alpha endpoint is unstable and subject to change. Do not use
439+
* this to upload a file larger than 150 MB. Instead, create an upload session
440+
* with upload_session/start.
441441
* Route attributes:
442442
* scope: files.content.write
443443
* @function Dropbox#filesAlphaUpload
444444
* @deprecated
445-
* @arg {FilesCommitInfoWithProperties} arg - The request parameters.
446-
* @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesUploadErrorWithProperties>>}
445+
* @arg {FilesUploadArg} arg - The request parameters.
446+
* @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesUploadError>>}
447447
*/
448448
routes.filesAlphaUpload = function (arg) {
449449
return this.request('files/alpha/upload', arg, 'user', 'content', 'upload', 'files.content.write');
@@ -1314,7 +1314,7 @@ routes.filesUnlockFileBatch = function (arg) {
13141314
* Route attributes:
13151315
* scope: files.content.write
13161316
* @function Dropbox#filesUpload
1317-
* @arg {FilesCommitInfo} arg - The request parameters.
1317+
* @arg {FilesUploadArg} arg - The request parameters.
13181318
* @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesUploadError>>}
13191319
*/
13201320
routes.filesUpload = function (arg) {
@@ -1333,7 +1333,7 @@ routes.filesUpload = function (arg) {
13331333
* scope: files.content.write
13341334
* @function Dropbox#filesUploadSessionAppendV2
13351335
* @arg {FilesUploadSessionAppendArg} arg - The request parameters.
1336-
* @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesUploadSessionLookupError>>}
1336+
* @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesUploadSessionAppendError>>}
13371337
*/
13381338
routes.filesUploadSessionAppendV2 = function (arg) {
13391339
return this.request('files/upload_session/append_v2', arg, 'user', 'content', 'upload', 'files.content.write');
@@ -1351,7 +1351,7 @@ routes.filesUploadSessionAppendV2 = function (arg) {
13511351
* @function Dropbox#filesUploadSessionAppend
13521352
* @deprecated
13531353
* @arg {FilesUploadSessionCursor} arg - The request parameters.
1354-
* @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesUploadSessionLookupError>>}
1354+
* @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesUploadSessionAppendError>>}
13551355
*/
13561356
routes.filesUploadSessionAppend = function (arg) {
13571357
return this.request('files/upload_session/append', arg, 'user', 'content', 'upload', 'files.content.write');

lib/types.js

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -821,33 +821,6 @@ only present when needed to discriminate between multiple possible subtypes.
821821

822822
/**
823823
* @typedef {Object} FilesCommitInfo
824-
* @property {Object} [contents] - The file contents to be uploaded.
825-
* @property {string} path - Path in the user's Dropbox to save the file.
826-
* @property {FilesWriteMode} mode - Selects what to do if the file already
827-
* exists.
828-
* @property {boolean} autorename - If there's a conflict, as determined by
829-
* mode, have the Dropbox server try to autorename the file to avoid conflict.
830-
* @property {Timestamp} [client_modified] - The value to store as the
831-
* client_modified timestamp. Dropbox automatically records the time at which
832-
* the file was written to the Dropbox servers. It can also record an additional
833-
* timestamp, provided by Dropbox desktop clients, mobile clients, and API apps
834-
* of when the file was actually created or modified.
835-
* @property {boolean} mute - Normally, users are made aware of any file
836-
* modifications in their Dropbox account via notifications in the client
837-
* software. If true, this tells the clients that this modification shouldn't
838-
* result in a user notification.
839-
* @property {Array.<FilePropertiesPropertyGroup>} [property_groups] - List of
840-
* custom properties to add to file.
841-
* @property {boolean} strict_conflict - Be more strict about how each WriteMode
842-
* detects conflict. For example, always return a conflict error when mode =
843-
* WriteMode.update and the given "rev" doesn't match the existing file's "rev",
844-
* even if the existing file has been deleted. This also forces a conflict even
845-
* when the target path refers to a file with identical contents.
846-
*/
847-
848-
/**
849-
* @typedef {Object} FilesCommitInfoWithProperties
850-
* @property {Object} [contents] - The file contents to be uploaded.
851824
* @property {string} path - Path in the user's Dropbox to save the file.
852825
* @property {FilesWriteMode} mode - Selects what to do if the file already
853826
* exists.
@@ -2291,23 +2264,43 @@ only present when needed to discriminate between multiple possible subtypes.
22912264
*/
22922265

22932266
/**
2294-
* @typedef {Object} FilesUploadError
2295-
* @property {FilesUploadWriteFailed} [path] - Available if .tag is path. Unable
2296-
* to save the uploaded contents to a file.
2297-
* @property {FilePropertiesInvalidPropertyGroupError} [properties_error] -
2298-
* Available if .tag is properties_error. The supplied property group is
2299-
* invalid. The file has uploaded without property groups.
2300-
* @property {('path'|'properties_error'|'payload_too_large'|'other')} .tag - Tag identifying the union variant.
2267+
* @typedef {Object} FilesUploadArg
2268+
* @property {Object} [contents] - The file contents to be uploaded.
2269+
* @property {string} path - Path in the user's Dropbox to save the file.
2270+
* @property {FilesWriteMode} mode - Selects what to do if the file already
2271+
* exists.
2272+
* @property {boolean} autorename - If there's a conflict, as determined by
2273+
* mode, have the Dropbox server try to autorename the file to avoid conflict.
2274+
* @property {Timestamp} [client_modified] - The value to store as the
2275+
* client_modified timestamp. Dropbox automatically records the time at which
2276+
* the file was written to the Dropbox servers. It can also record an additional
2277+
* timestamp, provided by Dropbox desktop clients, mobile clients, and API apps
2278+
* of when the file was actually created or modified.
2279+
* @property {boolean} mute - Normally, users are made aware of any file
2280+
* modifications in their Dropbox account via notifications in the client
2281+
* software. If true, this tells the clients that this modification shouldn't
2282+
* result in a user notification.
2283+
* @property {Array.<FilePropertiesPropertyGroup>} [property_groups] - List of
2284+
* custom properties to add to file.
2285+
* @property {boolean} strict_conflict - Be more strict about how each WriteMode
2286+
* detects conflict. For example, always return a conflict error when mode =
2287+
* WriteMode.update and the given "rev" doesn't match the existing file's "rev",
2288+
* even if the existing file has been deleted. This also forces a conflict even
2289+
* when the target path refers to a file with identical contents.
2290+
* @property {string} [content_hash] - NOT YET SUPPORTED. A hash of the file
2291+
* content uploaded in this call. If provided and the uploaded content does not
2292+
* match this hash, an error will be returned. For more information see our
2293+
* Content hash https://www.dropbox.com/developers/reference/content-hash page.
23012294
*/
23022295

23032296
/**
2304-
* @typedef {Object} FilesUploadErrorWithProperties
2297+
* @typedef {Object} FilesUploadError
23052298
* @property {FilesUploadWriteFailed} [path] - Available if .tag is path. Unable
23062299
* to save the uploaded contents to a file.
23072300
* @property {FilePropertiesInvalidPropertyGroupError} [properties_error] -
23082301
* Available if .tag is properties_error. The supplied property group is
23092302
* invalid. The file has uploaded without property groups.
2310-
* @property {('path'|'properties_error'|'payload_too_large'|'other')} .tag - Tag identifying the union variant.
2303+
* @property {('path'|'properties_error'|'payload_too_large'|'content_hash_mismatch'|'other')} .tag - Tag identifying the union variant.
23112304
*/
23122305

23132306
/**
@@ -2318,6 +2311,20 @@ only present when needed to discriminate between multiple possible subtypes.
23182311
* @property {boolean} close - If true, the current session will be closed, at
23192312
* which point you won't be able to call upload_session/append:2 anymore with
23202313
* the current session.
2314+
* @property {string} [content_hash] - NOT YET SUPPORTED. A hash of the file
2315+
* content uploaded in this call. If provided and the uploaded content does not
2316+
* match this hash, an error will be returned. For more information see our
2317+
* Content hash https://www.dropbox.com/developers/reference/content-hash page.
2318+
*/
2319+
2320+
/**
2321+
* @typedef {Object} FilesUploadSessionAppendError
2322+
* @property {FilesUploadSessionOffsetError} [incorrect_offset] - Available if
2323+
* .tag is incorrect_offset. The specified offset was incorrect. See the value
2324+
* for the correct offset. This error may occur when a previous request was
2325+
* received and processed successfully but the client did not receive the
2326+
* response, e.g. due to a network error.
2327+
* @property {('not_found'|'incorrect_offset'|'closed'|'not_closed'|'too_large'|'concurrent_session_invalid_offset'|'concurrent_session_invalid_data_size'|'payload_too_large'|'other'|'content_hash_mismatch')} .tag - Tag identifying the union variant.
23212328
*/
23222329

23232330
/**
@@ -2337,6 +2344,10 @@ only present when needed to discriminate between multiple possible subtypes.
23372344
* and the offset.
23382345
* @property {FilesCommitInfo} commit - Contains the path and other optional
23392346
* modifiers for the commit.
2347+
* @property {string} [content_hash] - NOT YET SUPPORTED. A hash of the file
2348+
* content uploaded in this call. If provided and the uploaded content does not
2349+
* match this hash, an error will be returned. For more information see our
2350+
* Content hash https://www.dropbox.com/developers/reference/content-hash page.
23402351
*/
23412352

23422353
/**
@@ -2390,7 +2401,7 @@ only present when needed to discriminate between multiple possible subtypes.
23902401
* @property {FilePropertiesInvalidPropertyGroupError} [properties_error] -
23912402
* Available if .tag is properties_error. The supplied property group is
23922403
* invalid. The file has uploaded without property groups.
2393-
* @property {('lookup_failed'|'path'|'properties_error'|'too_many_shared_folder_targets'|'too_many_write_operations'|'concurrent_session_data_not_allowed'|'concurrent_session_not_closed'|'concurrent_session_missing_data'|'payload_too_large'|'other')} .tag - Tag identifying the union variant.
2404+
* @property {('lookup_failed'|'path'|'properties_error'|'too_many_shared_folder_targets'|'too_many_write_operations'|'concurrent_session_data_not_allowed'|'concurrent_session_not_closed'|'concurrent_session_missing_data'|'payload_too_large'|'content_hash_mismatch'|'other')} .tag - Tag identifying the union variant.
23942405
*/
23952406

23962407
/**
@@ -2417,11 +2428,15 @@ only present when needed to discriminate between multiple possible subtypes.
24172428
* the current session.
24182429
* @property {FilesUploadSessionType} [session_type] - Type of upload session
24192430
* you want to start. If not specified, default is UploadSessionType.sequential.
2431+
* @property {string} [content_hash] - NOT YET SUPPORTED. A hash of the file
2432+
* content uploaded in this call. If provided and the uploaded content does not
2433+
* match this hash, an error will be returned. For more information see our
2434+
* Content hash https://www.dropbox.com/developers/reference/content-hash page.
24202435
*/
24212436

24222437
/**
24232438
* @typedef {Object} FilesUploadSessionStartError
2424-
* @property {('concurrent_session_data_not_allowed'|'concurrent_session_close_not_allowed'|'payload_too_large'|'other')} .tag - Tag identifying the union variant.
2439+
* @property {('concurrent_session_data_not_allowed'|'concurrent_session_close_not_allowed'|'payload_too_large'|'content_hash_mismatch'|'other')} .tag - Tag identifying the union variant.
24252440
*/
24262441

24272442
/**

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dropbox",
3-
"version": "10.24.0",
3+
"version": "10.25.0",
44
"registry": "npm",
55
"description": "The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.",
66
"main": "cjs/index.js",

types/dropbox_types.d.ts

Lines changed: 72 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,10 +1680,6 @@
16801680
export type BaseTagError = BaseTagErrorPath | BaseTagErrorOther;
16811681

16821682
export interface CommitInfo {
1683-
/**
1684-
* The file contents to be uploaded.
1685-
*/
1686-
contents?: Object;
16871683
/**
16881684
* Path in the user's Dropbox to save the file.
16891685
*/
@@ -1720,13 +1716,6 @@
17201716
strict_conflict?: boolean;
17211717
}
17221718

1723-
export interface CommitInfoWithProperties extends CommitInfo {
1724-
/**
1725-
* The file contents to be uploaded.
1726-
*/
1727-
contents?: Object;
1728-
}
1729-
17301719
export interface ContentSyncSetting {
17311720
/**
17321721
* Id of the item this setting is applied to.
@@ -4815,6 +4804,20 @@
48154804
entries: Array<UnlockFileArg>;
48164805
}
48174806

4807+
export interface UploadArg extends CommitInfo {
4808+
/**
4809+
* The file contents to be uploaded.
4810+
*/
4811+
contents?: Object;
4812+
/**
4813+
* NOT YET SUPPORTED. A hash of the file content uploaded in this call. If
4814+
* provided and the uploaded content does not match this hash, an error
4815+
* will be returned. For more information see our [Content hash]{@link
4816+
* https://www.dropbox.com/developers/reference/content-hash} page.
4817+
*/
4818+
content_hash?: Sha256HexHash;
4819+
}
4820+
48184821
/**
48194822
* Unable to save the uploaded contents to a file.
48204823
*/
@@ -4838,13 +4841,19 @@
48384841
'.tag': 'payload_too_large';
48394842
}
48404843

4844+
/**
4845+
* The content received by the Dropbox server in this call does not match
4846+
* the provided content hash.
4847+
*/
4848+
export interface UploadErrorContentHashMismatch {
4849+
'.tag': 'content_hash_mismatch';
4850+
}
4851+
48414852
export interface UploadErrorOther {
48424853
'.tag': 'other';
48434854
}
48444855

4845-
export type UploadError = UploadErrorPath | UploadErrorPropertiesError | UploadErrorPayloadTooLarge | UploadErrorOther;
4846-
4847-
export type UploadErrorWithProperties = UploadError;
4856+
export type UploadError = UploadErrorPath | UploadErrorPropertiesError | UploadErrorPayloadTooLarge | UploadErrorContentHashMismatch | UploadErrorOther;
48484857

48494858
export interface UploadSessionAppendArg {
48504859
/**
@@ -4859,8 +4868,25 @@
48594868
* Defaults to False.
48604869
*/
48614870
close?: boolean;
4871+
/**
4872+
* NOT YET SUPPORTED. A hash of the file content uploaded in this call. If
4873+
* provided and the uploaded content does not match this hash, an error
4874+
* will be returned. For more information see our [Content hash]{@link
4875+
* https://www.dropbox.com/developers/reference/content-hash} page.
4876+
*/
4877+
content_hash?: Sha256HexHash;
48624878
}
48634879

4880+
/**
4881+
* The content received by the Dropbox server in this call does not match
4882+
* the provided content hash.
4883+
*/
4884+
export interface UploadSessionAppendErrorContentHashMismatch {
4885+
'.tag': 'content_hash_mismatch';
4886+
}
4887+
4888+
export type UploadSessionAppendError = UploadSessionLookupError | UploadSessionAppendErrorContentHashMismatch;
4889+
48644890
export interface UploadSessionCursor {
48654891
/**
48664892
* The file contents to be uploaded.
@@ -4891,6 +4917,13 @@
48914917
* Contains the path and other optional modifiers for the commit.
48924918
*/
48934919
commit: CommitInfo;
4920+
/**
4921+
* NOT YET SUPPORTED. A hash of the file content uploaded in this call. If
4922+
* provided and the uploaded content does not match this hash, an error
4923+
* will be returned. For more information see our [Content hash]{@link
4924+
* https://www.dropbox.com/developers/reference/content-hash} page.
4925+
*/
4926+
content_hash?: Sha256HexHash;
48944927
}
48954928

48964929
export interface UploadSessionFinishBatchArg {
@@ -5014,11 +5047,19 @@
50145047
'.tag': 'payload_too_large';
50155048
}
50165049

5050+
/**
5051+
* The content received by the Dropbox server in this call does not match
5052+
* the provided content hash.
5053+
*/
5054+
export interface UploadSessionFinishErrorContentHashMismatch {
5055+
'.tag': 'content_hash_mismatch';
5056+
}
5057+
50175058
export interface UploadSessionFinishErrorOther {
50185059
'.tag': 'other';
50195060
}
50205061

5021-
export type UploadSessionFinishError = UploadSessionFinishErrorLookupFailed | UploadSessionFinishErrorPath | UploadSessionFinishErrorPropertiesError | UploadSessionFinishErrorTooManySharedFolderTargets | UploadSessionFinishErrorTooManyWriteOperations | UploadSessionFinishErrorConcurrentSessionDataNotAllowed | UploadSessionFinishErrorConcurrentSessionNotClosed | UploadSessionFinishErrorConcurrentSessionMissingData | UploadSessionFinishErrorPayloadTooLarge | UploadSessionFinishErrorOther;
5062+
export type UploadSessionFinishError = UploadSessionFinishErrorLookupFailed | UploadSessionFinishErrorPath | UploadSessionFinishErrorPropertiesError | UploadSessionFinishErrorTooManySharedFolderTargets | UploadSessionFinishErrorTooManyWriteOperations | UploadSessionFinishErrorConcurrentSessionDataNotAllowed | UploadSessionFinishErrorConcurrentSessionNotClosed | UploadSessionFinishErrorConcurrentSessionMissingData | UploadSessionFinishErrorPayloadTooLarge | UploadSessionFinishErrorContentHashMismatch | UploadSessionFinishErrorOther;
50225063

50235064
/**
50245065
* The upload session ID was not found or has expired. Upload sessions are
@@ -5111,6 +5152,13 @@
51115152
* UploadSessionType.sequential.
51125153
*/
51135154
session_type?: UploadSessionType;
5155+
/**
5156+
* NOT YET SUPPORTED. A hash of the file content uploaded in this call. If
5157+
* provided and the uploaded content does not match this hash, an error
5158+
* will be returned. For more information see our [Content hash]{@link
5159+
* https://www.dropbox.com/developers/reference/content-hash} page.
5160+
*/
5161+
content_hash?: Sha256HexHash;
51145162
}
51155163

51165164
/**
@@ -5134,11 +5182,19 @@
51345182
'.tag': 'payload_too_large';
51355183
}
51365184

5185+
/**
5186+
* The content received by the Dropbox server in this call does not match
5187+
* the provided content hash.
5188+
*/
5189+
export interface UploadSessionStartErrorContentHashMismatch {
5190+
'.tag': 'content_hash_mismatch';
5191+
}
5192+
51375193
export interface UploadSessionStartErrorOther {
51385194
'.tag': 'other';
51395195
}
51405196

5141-
export type UploadSessionStartError = UploadSessionStartErrorConcurrentSessionDataNotAllowed | UploadSessionStartErrorConcurrentSessionCloseNotAllowed | UploadSessionStartErrorPayloadTooLarge | UploadSessionStartErrorOther;
5197+
export type UploadSessionStartError = UploadSessionStartErrorConcurrentSessionDataNotAllowed | UploadSessionStartErrorConcurrentSessionCloseNotAllowed | UploadSessionStartErrorPayloadTooLarge | UploadSessionStartErrorContentHashMismatch | UploadSessionStartErrorOther;
51425198

51435199
export interface UploadSessionStartResult {
51445200
/**

0 commit comments

Comments
 (0)