Skip to content

Commit 3fadb55

Browse files
authored
Automated Spec Update (#849)
6e0a08f15d3f28359208e079656780789361a95f Change Notes: files Namespace - Update list_folder route to include app auth - Update list_folder/continue route to include app auth - Update Examples Add file_tagging Namespace Co-authored-by: DropboxBot <DropboxBot@users.noreply.github.com>
1 parent 0fd7f5d commit 3fadb55

File tree

7 files changed

+263
-5
lines changed

7 files changed

+263
-5
lines changed

lib/routes.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ routes.filesGetThumbnailBatch = function (arg) {
765765
* @returns {Promise.<DropboxResponse<FilesListFolderResult>, DropboxResponseError.<FilesListFolderError>>}
766766
*/
767767
routes.filesListFolder = function (arg) {
768-
return this.request('files/list_folder', arg, 'user', 'api', 'rpc');
768+
return this.request('files/list_folder', arg, 'app, user', 'api', 'rpc');
769769
};
770770

771771
/**
@@ -777,7 +777,7 @@ routes.filesListFolder = function (arg) {
777777
* @returns {Promise.<DropboxResponse<FilesListFolderResult>, DropboxResponseError.<FilesListFolderContinueError>>}
778778
*/
779779
routes.filesListFolderContinue = function (arg) {
780-
return this.request('files/list_folder/continue', arg, 'user', 'api', 'rpc');
780+
return this.request('files/list_folder/continue', arg, 'app, user', 'api', 'rpc');
781781
};
782782

783783
/**
@@ -1081,6 +1081,37 @@ routes.filesSearchContinueV2 = function (arg) {
10811081
return this.request('files/search/continue_v2', arg, 'user', 'api', 'rpc');
10821082
};
10831083

1084+
/**
1085+
* Add a tag to an item. A tag is a string. No more than 20 tags can be added to
1086+
* a given item.
1087+
* @function Dropbox#filesTagsAdd
1088+
* @arg {FilesAddTagArg} arg - The request parameters.
1089+
* @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesAddTagError>>}
1090+
*/
1091+
routes.filesTagsAdd = function (arg) {
1092+
return this.request('files/tags/add', arg, 'user', 'api', 'rpc');
1093+
};
1094+
1095+
/**
1096+
* Get list of tags assigned to items.
1097+
* @function Dropbox#filesTagsGet
1098+
* @arg {FilesGetTagsArg} arg - The request parameters.
1099+
* @returns {Promise.<DropboxResponse<FilesGetTagsResult>, DropboxResponseError.<FilesBaseTagError>>}
1100+
*/
1101+
routes.filesTagsGet = function (arg) {
1102+
return this.request('files/tags/get', arg, 'user', 'api', 'rpc');
1103+
};
1104+
1105+
/**
1106+
* Remove a tag from an item.
1107+
* @function Dropbox#filesTagsRemove
1108+
* @arg {FilesRemoveTagArg} arg - The request parameters.
1109+
* @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesRemoveTagError>>}
1110+
*/
1111+
routes.filesTagsRemove = function (arg) {
1112+
return this.request('files/tags/remove', arg, 'user', 'api', 'rpc');
1113+
};
1114+
10841115
/**
10851116
* Unlock the files at the given paths. A locked file can only be unlocked by
10861117
* the lock holder or, if a business account, a team admin. A successful

lib/types.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,17 @@ only present when needed to discriminate between multiple possible subtypes.
773773
* @property {('disabled_for_team'|'other'|'not_found'|'not_a_folder'|'app_lacks_access'|'no_permission'|'email_unverified'|'validation_error')} .tag - Tag identifying the union variant.
774774
*/
775775

776+
/**
777+
* @typedef {Object} FilesAddTagArg
778+
* @property {string} path - Path to the item to be tagged.
779+
* @property {string} tag_text - The value of the tag to add.
780+
*/
781+
782+
/**
783+
* @typedef {Object} FilesAddTagError
784+
* @property {('unknown'|'transient'|'input_validation'|'cancelled'|'other'|'feature_not_supported'|'path_not_found'|'too_many_tags')} .tag - Tag identifying the union variant.
785+
*/
786+
776787
/**
777788
* @typedef {Object} FilesAlphaGetMetadataArg
778789
* @property {string} path - The path of a file or folder on Dropbox.
@@ -801,6 +812,16 @@ only present when needed to discriminate between multiple possible subtypes.
801812
* @property {('path'|'properties_error')} .tag - Tag identifying the union variant.
802813
*/
803814

815+
/**
816+
* @typedef {Object} FilesBaseError
817+
* @property {('unknown'|'transient'|'input_validation'|'cancelled'|'other')} .tag - Tag identifying the union variant.
818+
*/
819+
820+
/**
821+
* @typedef {Object} FilesBaseTagError
822+
* @property {('unknown'|'transient'|'input_validation'|'cancelled'|'other'|'feature_not_supported'|'path_not_found')} .tag - Tag identifying the union variant.
823+
*/
824+
804825
/**
805826
* @typedef {Object} FilesCommitInfo
806827
* @property {Object} [contents] - The file contents to be uploaded.
@@ -1318,6 +1339,17 @@ is only present when needed to discriminate between multiple possible subtypes.
13181339
* @property {'path'} .tag - Tag identifying the union variant.
13191340
*/
13201341

1342+
/**
1343+
* @typedef {Object} FilesGetTagsArg
1344+
* @property {Array.<Object>} paths - Path to the items.
1345+
*/
1346+
1347+
/**
1348+
* @typedef {Object} FilesGetTagsResult
1349+
* @property {Array.<FilesPathToTags>} paths_to_tags - List of paths and their
1350+
* corresponding tags.
1351+
*/
1352+
13211353
/**
13221354
* @typedef {Object} FilesGetTemporaryLinkArg
13231355
* @property {string} path - The path to the file you want a temporary link to.
@@ -1730,6 +1762,12 @@ variant.
17301762
* @property {('path'|'link'|'other')} .tag - Tag identifying the union variant.
17311763
*/
17321764

1765+
/**
1766+
* @typedef {Object} FilesPathToTags
1767+
* @property {string} path - Path of the item.
1768+
* @property {Array.<FilesTag>} tags - Tags assigned to this item.
1769+
*/
1770+
17331771
/**
17341772
* Metadata for a photo.
17351773
* @typedef {Object} FilesPhotoMetadata
@@ -1913,6 +1951,17 @@ only present when needed to discriminate between multiple possible subtypes.
19131951
* metadata - Metadata of the relocated object.
19141952
*/
19151953

1954+
/**
1955+
* @typedef {Object} FilesRemoveTagArg
1956+
* @property {string} path - Path to the item to tag.
1957+
* @property {string} tag_text - The tag to remove.
1958+
*/
1959+
1960+
/**
1961+
* @typedef {Object} FilesRemoveTagError
1962+
* @property {('unknown'|'transient'|'input_validation'|'cancelled'|'other'|'feature_not_supported'|'path_not_found'|'tag_not_exists_for_this_path')} .tag - Tag identifying the union variant.
1963+
*/
1964+
19161965
/**
19171966
* @typedef {Object} FilesRestoreArg
19181967
* @property {string} path - The path to save the restored file.
@@ -2159,6 +2208,14 @@ only present when needed to discriminate between multiple possible subtypes.
21592208
* @property {('path'|'unsupported_combination'|'unsupported_configuration'|'other')} .tag - Tag identifying the union variant.
21602209
*/
21612210

2211+
/**
2212+
* Tag that can be added in multiple ways.
2213+
* @typedef {Object} FilesTag
2214+
* @property {FilesUserGeneratedTag} [user_generated_tag] - Available if .tag is
2215+
* user_generated_tag. Tag generated by the user.
2216+
* @property {('user_generated_tag'|'other')} .tag - Tag identifying the union variant.
2217+
*/
2218+
21622219
/**
21632220
* @typedef {Object} FilesThumbnailArg
21642221
* @property {string} path - The path to the image file you want to thumbnail.
@@ -2378,6 +2435,11 @@ only present when needed to discriminate between multiple possible subtypes.
23782435
* used to retry the commit with upload_session/finish.
23792436
*/
23802437

2438+
/**
2439+
* @typedef {Object} FilesUserGeneratedTag
2440+
* @property {string} tag_text
2441+
*/
2442+
23812443
/**
23822444
* Metadata for a video.
23832445
* @typedef {Object} FilesVideoMetadata

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.16.0",
3+
"version": "10.17.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: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,26 @@
16331633
* This namespace contains endpoints and data types for basic file operations.
16341634
*/
16351635
export namespace files {
1636+
export interface AddTagArg {
1637+
/**
1638+
* Path to the item to be tagged.
1639+
*/
1640+
path: Path;
1641+
/**
1642+
* The value of the tag to add.
1643+
*/
1644+
tag_text: TagText;
1645+
}
1646+
1647+
/**
1648+
* Item already has max supported tags.
1649+
*/
1650+
export interface AddTagErrorTooManyTags {
1651+
'.tag': 'too_many_tags';
1652+
}
1653+
1654+
export type AddTagError = BaseTagError | AddTagErrorTooManyTags;
1655+
16361656
export interface AlphaGetMetadataArg extends GetMetadataArg {
16371657
/**
16381658
* If set to a valid list of template IDs, FileMetadata.property_groups is
@@ -1648,6 +1668,56 @@
16481668

16491669
export type AlphaGetMetadataError = GetMetadataError | AlphaGetMetadataErrorPropertiesError;
16501670

1671+
/**
1672+
* Action failed.
1673+
*/
1674+
export interface BaseErrorUnknown {
1675+
'.tag': 'unknown';
1676+
}
1677+
1678+
/**
1679+
* Action failed. Try again.
1680+
*/
1681+
export interface BaseErrorTransient {
1682+
'.tag': 'transient';
1683+
}
1684+
1685+
/**
1686+
* Action failed due to wrong params.
1687+
*/
1688+
export interface BaseErrorInputValidation {
1689+
'.tag': 'input_validation';
1690+
}
1691+
1692+
/**
1693+
* Action cancelled.
1694+
*/
1695+
export interface BaseErrorCancelled {
1696+
'.tag': 'cancelled';
1697+
}
1698+
1699+
export interface BaseErrorOther {
1700+
'.tag': 'other';
1701+
}
1702+
1703+
export type BaseError = BaseErrorUnknown | BaseErrorTransient | BaseErrorInputValidation | BaseErrorCancelled | BaseErrorOther;
1704+
1705+
/**
1706+
* Tags are not turned on for your team. Please turn on the feature.
1707+
*/
1708+
export interface BaseTagErrorFeatureNotSupported {
1709+
'.tag': 'feature_not_supported';
1710+
}
1711+
1712+
/**
1713+
* Path not found.
1714+
*/
1715+
export interface BaseTagErrorPathNotFound {
1716+
'.tag': 'path_not_found';
1717+
}
1718+
1719+
export type BaseTagError = BaseError | BaseTagErrorFeatureNotSupported | BaseTagErrorPathNotFound;
1720+
16511721
export interface CommitInfo {
16521722
/**
16531723
* The file contents to be uploaded.
@@ -2535,6 +2605,20 @@
25352605

25362606
export type GetMetadataError = GetMetadataErrorPath;
25372607

2608+
export interface GetTagsArg {
2609+
/**
2610+
* Path to the items.
2611+
*/
2612+
paths: Array<Path>;
2613+
}
2614+
2615+
export interface GetTagsResult {
2616+
/**
2617+
* List of paths and their corresponding tags.
2618+
*/
2619+
paths_to_tags: Array<PathToTags>;
2620+
}
2621+
25382622
export interface GetTemporaryLinkArg {
25392623
/**
25402624
* The path to the file you want a temporary link to.
@@ -3490,6 +3574,17 @@
34903574

34913575
export type PathOrLink = PathOrLinkPath | PathOrLinkLink | PathOrLinkOther;
34923576

3577+
export interface PathToTags {
3578+
/**
3579+
* Path of the item.
3580+
*/
3581+
path: Path;
3582+
/**
3583+
* Tags assigned to this item.
3584+
*/
3585+
tags: Array<Tag>;
3586+
}
3587+
34933588
/**
34943589
* Metadata for a photo.
34953590
*/
@@ -3850,6 +3945,26 @@
38503945
metadata: FileMetadataReference|FolderMetadataReference|DeletedMetadataReference;
38513946
}
38523947

3948+
export interface RemoveTagArg {
3949+
/**
3950+
* Path to the item to tag.
3951+
*/
3952+
path: Path;
3953+
/**
3954+
* The tag to remove.
3955+
*/
3956+
tag_text: TagText;
3957+
}
3958+
3959+
/**
3960+
* That tag doesn't exist at this path.
3961+
*/
3962+
export interface RemoveTagErrorTagNotExistsForThisPath {
3963+
'.tag': 'tag_not_exists_for_this_path';
3964+
}
3965+
3966+
export type RemoveTagError = BaseTagError | RemoveTagErrorTagNotExistsForThisPath;
3967+
38533968
export interface RestoreArg {
38543969
/**
38553970
* The path to save the restored file.
@@ -4449,6 +4564,22 @@
44494564

44504565
export type SyncSettingsError = SyncSettingsErrorPath | SyncSettingsErrorUnsupportedCombination | SyncSettingsErrorUnsupportedConfiguration | SyncSettingsErrorOther;
44514566

4567+
/**
4568+
* Tag generated by the user.
4569+
*/
4570+
export interface TagUserGeneratedTag extends UserGeneratedTag {
4571+
'.tag': 'user_generated_tag';
4572+
}
4573+
4574+
export interface TagOther {
4575+
'.tag': 'other';
4576+
}
4577+
4578+
/**
4579+
* Tag that can be added in multiple ways.
4580+
*/
4581+
export type Tag = TagUserGeneratedTag | TagOther;
4582+
44524583
export interface ThumbnailArg {
44534584
/**
44544585
* The path to the image file you want to thumbnail.
@@ -5040,6 +5171,10 @@
50405171
upload_session_id: string;
50415172
}
50425173

5174+
export interface UserGeneratedTag {
5175+
tag_text: TagText;
5176+
}
5177+
50435178
/**
50445179
* Metadata for a video.
50455180
*/
@@ -5232,6 +5367,8 @@
52325367

52335368
export type SharedLinkUrl = string;
52345369

5370+
export type TagText = string;
5371+
52355372
export type WritePath = string;
52365373

52375374
export type WritePathOrId = string;

0 commit comments

Comments
 (0)