box-node-sdk 1.35.0 → 1.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -2
- package/README.md +1 -1
- package/lib/api-request-manager.d.ts +38 -0
- package/lib/api-request-manager.js +48 -55
- package/lib/api-request-manager.js.map +1 -0
- package/lib/api-request.d.ts +141 -0
- package/lib/api-request.js +202 -281
- package/lib/api-request.js.map +1 -0
- package/lib/box-client.d.ts +269 -0
- package/lib/box-client.js +551 -713
- package/lib/box-client.js.map +1 -0
- package/lib/box-node-sdk.d.ts +216 -0
- package/lib/box-node-sdk.js +317 -352
- package/lib/box-node-sdk.js.map +1 -0
- package/lib/chunked-uploader.d.ts +129 -0
- package/lib/chunked-uploader.js +287 -358
- package/lib/chunked-uploader.js.map +1 -0
- package/lib/enterprise-event-stream.d.ts +82 -0
- package/lib/enterprise-event-stream.js +189 -203
- package/lib/enterprise-event-stream.js.map +1 -0
- package/lib/event-stream.d.ts +92 -0
- package/lib/event-stream.js +274 -302
- package/lib/event-stream.js.map +1 -0
- package/lib/managers/collaboration-allowlist.d.ts +137 -0
- package/lib/managers/collaboration-allowlist.js +200 -0
- package/lib/managers/collaboration-allowlist.js.map +1 -0
- package/lib/managers/collaboration-whitelist.d.ts +3 -0
- package/lib/managers/collaboration-whitelist.js +8 -222
- package/lib/managers/collaboration-whitelist.js.map +1 -0
- package/lib/managers/collaborations.d.ts +166 -0
- package/lib/managers/collaborations.js +225 -258
- package/lib/managers/collaborations.js.map +1 -0
- package/lib/managers/collections.d.ts +42 -0
- package/lib/managers/collections.js +45 -50
- package/lib/managers/collections.js.map +1 -0
- package/lib/managers/comments.d.ts +103 -0
- package/lib/managers/comments.js +158 -173
- package/lib/managers/comments.js.map +1 -0
- package/lib/managers/device-pins.d.ts +52 -0
- package/lib/managers/device-pins.js +75 -88
- package/lib/managers/device-pins.js.map +1 -0
- package/lib/managers/enterprise.d.ts +162 -0
- package/lib/managers/enterprise.js +168 -199
- package/lib/managers/enterprise.js.map +1 -0
- package/lib/managers/events.d.ts +177 -0
- package/lib/managers/events.js +230 -254
- package/lib/managers/events.js.map +1 -0
- package/lib/managers/files.d.ts +772 -0
- package/lib/managers/files.js +1400 -1602
- package/lib/managers/files.js.map +1 -0
- package/lib/managers/folders.d.ts +347 -0
- package/lib/managers/folders.js +551 -567
- package/lib/managers/folders.js.map +1 -0
- package/lib/managers/groups.d.ts +202 -0
- package/lib/managers/groups.js +238 -287
- package/lib/managers/groups.js.map +1 -0
- package/lib/managers/legal-hold-policies.d.ts +190 -0
- package/lib/managers/legal-hold-policies.js +228 -272
- package/lib/managers/legal-hold-policies.js.map +1 -0
- package/lib/managers/metadata.d.ts +228 -0
- package/lib/managers/metadata.js +265 -328
- package/lib/managers/metadata.js.map +1 -0
- package/lib/managers/recent-items.d.ts +38 -0
- package/lib/managers/recent-items.js +32 -39
- package/lib/managers/recent-items.js.map +1 -0
- package/lib/managers/retention-policies.d.ts +213 -0
- package/lib/managers/retention-policies.js +235 -281
- package/lib/managers/retention-policies.js.map +1 -0
- package/lib/managers/search.d.ts +82 -0
- package/lib/managers/search.js +68 -88
- package/lib/managers/search.js.map +1 -0
- package/lib/managers/shared-items.d.ts +33 -0
- package/lib/managers/shared-items.js +54 -62
- package/lib/managers/shared-items.js.map +1 -0
- package/lib/managers/storage-policies.d.ts +86 -0
- package/lib/managers/storage-policies.js +108 -142
- package/lib/managers/storage-policies.js.map +1 -0
- package/lib/managers/tasks.d.ts +161 -0
- package/lib/managers/tasks.js +219 -260
- package/lib/managers/tasks.js.map +1 -0
- package/lib/managers/terms-of-service.d.ts +161 -0
- package/lib/managers/terms-of-service.js +250 -273
- package/lib/managers/terms-of-service.js.map +1 -0
- package/lib/managers/trash.d.ts +30 -0
- package/lib/managers/trash.js +30 -41
- package/lib/managers/trash.js.map +1 -0
- package/lib/managers/users.d.ts +131 -0
- package/lib/managers/users.js +160 -203
- package/lib/managers/users.js.map +1 -0
- package/lib/managers/web-links.d.ts +127 -0
- package/lib/managers/web-links.js +183 -209
- package/lib/managers/web-links.js.map +1 -0
- package/lib/managers/webhooks.d.ts +166 -0
- package/lib/managers/webhooks.js +312 -305
- package/lib/managers/webhooks.js.map +1 -0
- package/lib/sessions/anonymous-session.d.ts +69 -0
- package/lib/sessions/anonymous-session.js +88 -102
- package/lib/sessions/anonymous-session.js.map +1 -0
- package/lib/sessions/app-auth-session.d.ts +92 -0
- package/lib/sessions/app-auth-session.js +140 -160
- package/lib/sessions/app-auth-session.js.map +1 -0
- package/lib/sessions/basic-session.d.ts +56 -0
- package/lib/sessions/basic-session.js +40 -50
- package/lib/sessions/basic-session.js.map +1 -0
- package/lib/sessions/persistent-session.d.ts +96 -0
- package/lib/sessions/persistent-session.js +191 -211
- package/lib/sessions/persistent-session.js.map +1 -0
- package/lib/token-manager.d.ts +191 -0
- package/lib/token-manager.js +390 -465
- package/lib/token-manager.js.map +1 -0
- package/lib/util/config.d.ts +86 -0
- package/lib/util/config.js +124 -152
- package/lib/util/config.js.map +1 -0
- package/lib/util/errors.d.ts +50 -0
- package/lib/util/errors.js +134 -145
- package/lib/util/errors.js.map +1 -0
- package/lib/util/exponential-backoff.d.ts +11 -0
- package/lib/util/exponential-backoff.js +10 -22
- package/lib/util/exponential-backoff.js.map +1 -0
- package/lib/util/paging-iterator.d.ts +53 -0
- package/lib/util/paging-iterator.js +202 -218
- package/lib/util/paging-iterator.js.map +1 -0
- package/lib/util/url-path.d.ts +16 -0
- package/lib/util/url-path.js +20 -35
- package/lib/util/url-path.js.map +1 -0
- package/package.json +24 -9
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Manager for the Box Metadata Resource
|
|
3
|
+
*/
|
|
4
|
+
import BoxClient from '../box-client';
|
|
5
|
+
/**
|
|
6
|
+
* Valid metadata field types
|
|
7
|
+
* @readonly
|
|
8
|
+
* @enum {MetadataFieldType}
|
|
9
|
+
*/
|
|
10
|
+
declare enum MetadataFieldType {
|
|
11
|
+
STRING = "string",
|
|
12
|
+
ENUM = "enum",
|
|
13
|
+
NUMBER = "float",
|
|
14
|
+
DATE = "date",
|
|
15
|
+
MULTI_SELECT = "multiSelect"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Metadata enum option
|
|
19
|
+
* @typedef {Object} MetadataEnumOption
|
|
20
|
+
* @property {string} key The option value
|
|
21
|
+
*/
|
|
22
|
+
declare type MetadataEnumOption = {
|
|
23
|
+
key: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Field definition for a metadata template
|
|
27
|
+
* @typedef {Object} MetadataTemplateField
|
|
28
|
+
* @property {MetadataFieldType} type The type of the field
|
|
29
|
+
* @property {string} key The programmatic name of the field
|
|
30
|
+
* @property {string} displayName The display name of the field
|
|
31
|
+
* @property {MetadataEnumOption[]} [options] For enum fields, the options
|
|
32
|
+
*/
|
|
33
|
+
declare type MetadataTemplateField = {
|
|
34
|
+
type: MetadataFieldType;
|
|
35
|
+
key: string;
|
|
36
|
+
displayName: string;
|
|
37
|
+
options?: MetadataEnumOption[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Simple manager for interacting with all metadata endpoints and actions.
|
|
41
|
+
*
|
|
42
|
+
* @constructor
|
|
43
|
+
* @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
|
|
44
|
+
* @returns {void}
|
|
45
|
+
*/
|
|
46
|
+
declare class Metadata {
|
|
47
|
+
client: BoxClient;
|
|
48
|
+
templates: Record<string, any>;
|
|
49
|
+
scopes: Record<string, any>;
|
|
50
|
+
cascadeResolution: Record<string, any>;
|
|
51
|
+
fieldTypes: typeof MetadataFieldType;
|
|
52
|
+
constructor(client: BoxClient);
|
|
53
|
+
/**
|
|
54
|
+
* Retrieve the schema definition for a metadata template
|
|
55
|
+
*
|
|
56
|
+
* API Endpoint: '/metadata_templates/:scope/:template'
|
|
57
|
+
* Method: GET
|
|
58
|
+
*
|
|
59
|
+
* @param {string} scope - The scope of the template, e.g. "enterprise"
|
|
60
|
+
* @param {string} template - The template to retrieve
|
|
61
|
+
* @param {Function} [callback] - Called with the template schema if successful
|
|
62
|
+
* @returns {Promise<Object>} A promise resolving to the template schema
|
|
63
|
+
*/
|
|
64
|
+
getTemplateSchema(scope: string, template: string, callback?: Function): any;
|
|
65
|
+
/**
|
|
66
|
+
* Retrieve the schema definition for a metadata template by ID
|
|
67
|
+
*
|
|
68
|
+
* API Endpoint: '/metadata_templates/:id'
|
|
69
|
+
* Method: GET
|
|
70
|
+
*
|
|
71
|
+
* @param {string} templateID - The ID of the template to retrieve
|
|
72
|
+
* @param {Function} [callback] - Called with the template schema if successful
|
|
73
|
+
* @returns {Promise<Object>} A promise resolving to the template schema
|
|
74
|
+
*/
|
|
75
|
+
getTemplateByID(templateID: string, callback?: Function): any;
|
|
76
|
+
/**
|
|
77
|
+
* Get all templates in a given scope
|
|
78
|
+
*
|
|
79
|
+
* API Endpoint: '/metadata_templates/:scope'
|
|
80
|
+
* Method: GET
|
|
81
|
+
*
|
|
82
|
+
* @param {string} scope - The scope to retrieve templates for
|
|
83
|
+
* @param {Function} [callback] - Called with an array of templates when successful
|
|
84
|
+
* @returns {Promise<Object>} A promise resolving to the collection of templates
|
|
85
|
+
*/
|
|
86
|
+
getTemplates(scope: string, callback?: Function): any;
|
|
87
|
+
/**
|
|
88
|
+
* Create a new metadata template
|
|
89
|
+
*
|
|
90
|
+
* API Endpoint: '/metadata_templates/schema',
|
|
91
|
+
* Method: POST
|
|
92
|
+
*
|
|
93
|
+
* @param {string} templateName - The name of the metadata template
|
|
94
|
+
* @param {MetadataTemplateField[]} fields - A list of fields for the template
|
|
95
|
+
* @param {Object} [options] - Optional parameters, can be left null in many cases
|
|
96
|
+
* @param {string} [options.templateKey] - The programmatic key for the template
|
|
97
|
+
* @param {boolean} [options.hidden] - Whether the template should be hidden in the UI
|
|
98
|
+
* @param {string} [options.scope=enterprise] - The scope for the template, only 'enterprise' is supported for now
|
|
99
|
+
* @param {boolean} [options.copyInstanceOnItemCopy] - Whether to include the metadata when a file or folder is copied
|
|
100
|
+
* @param {Function} [callback] - Passed the template if successful, error otherwise
|
|
101
|
+
* @returns {Promise<Object>} A promise resolving to the created template
|
|
102
|
+
*/
|
|
103
|
+
createTemplate(templateName: string, fields: MetadataTemplateField[], options?: {
|
|
104
|
+
templateKey?: string;
|
|
105
|
+
hidden?: boolean;
|
|
106
|
+
scope?: string;
|
|
107
|
+
copyInstanceOnItemCopy?: boolean;
|
|
108
|
+
}, callback?: Function): any;
|
|
109
|
+
/**
|
|
110
|
+
* Update a metadata template via one or more non-breaking operations. Each
|
|
111
|
+
* operation is a an object descrbing one change to the template or its
|
|
112
|
+
* fields.
|
|
113
|
+
*
|
|
114
|
+
* API Endpoint: '/metadata_templates/:scope/:template/schema'
|
|
115
|
+
* Method: PUT
|
|
116
|
+
*
|
|
117
|
+
* @param {string} scope - The scope of the template to modify
|
|
118
|
+
* @param {string} template - The template to modify
|
|
119
|
+
* @param {Object[]} operations - The operations to perform
|
|
120
|
+
* @param {Function} [callback] - Passed the updated template if successful, error otherwise
|
|
121
|
+
* @returns {Promise<Object>} A promise resolving to the updated template
|
|
122
|
+
* @see {@link https://developer.box.com/en/reference/put-metadata-templates-id-id-schema/}
|
|
123
|
+
*/
|
|
124
|
+
updateTemplate(scope: string, template: string, operations: Record<string, any>[], callback?: Function): any;
|
|
125
|
+
/**
|
|
126
|
+
* Delete a metadata template from an enterprise.
|
|
127
|
+
*
|
|
128
|
+
* API Endpoint: '/metadata_templates/:scope/:template/schema'
|
|
129
|
+
* Method: DELETE
|
|
130
|
+
*
|
|
131
|
+
* @param {string} scope - The scope of the template to delete
|
|
132
|
+
* @param {string} template - The template to delete
|
|
133
|
+
* @param {Function} [callback] - Passed empty response body if successful, err otherwise
|
|
134
|
+
* @returns {Promise<void>} A promise resolving to nothing
|
|
135
|
+
* @see {@link https://developer.box.com/en/reference/delete-metadata-templates-id-id-schema/}
|
|
136
|
+
*/
|
|
137
|
+
deleteTemplate(scope: string, template: string, callback?: Function): any;
|
|
138
|
+
/**
|
|
139
|
+
* Get the cascade policies associated with a given folder.
|
|
140
|
+
*
|
|
141
|
+
* API Endpoint: '/metadata_cascade_policies'
|
|
142
|
+
* Method: GET
|
|
143
|
+
*
|
|
144
|
+
* @param {string} folderID The ID of the folder to get cascade policies for
|
|
145
|
+
* @param {Object} [options] Optional parameters
|
|
146
|
+
* @param {string} [options.owner_enterprise_id] ID of the enterprise to get policies for
|
|
147
|
+
* @param {Function} [callback] Passed the collection of policies if successful
|
|
148
|
+
* @returns {Promise<Object>} Promise resolving to the collection of policies
|
|
149
|
+
*/
|
|
150
|
+
getCascadePolicies(folderID: string, options?: {
|
|
151
|
+
owner_enterprise_id?: string;
|
|
152
|
+
}, callback?: Function): any;
|
|
153
|
+
/**
|
|
154
|
+
* Get a metadata cascade policy object by ID
|
|
155
|
+
*
|
|
156
|
+
* API Endpoint: '/metadata_cascade_policies/:policyID'
|
|
157
|
+
* Method: GET
|
|
158
|
+
*
|
|
159
|
+
* @param {string} policyID The ID of the policy to retrieve
|
|
160
|
+
* @param {Function} [callback] Passed the cascade policy if successful
|
|
161
|
+
* @returns {Promise<Object>} Promise resolving to the cascade policy
|
|
162
|
+
*/
|
|
163
|
+
getCascadePolicy(policyID: string, callback?: Function): any;
|
|
164
|
+
/**
|
|
165
|
+
* Add a new cascade policy to a folder/metadata template, causing the
|
|
166
|
+
* metadata template to be applied to all items and subfolders inside the
|
|
167
|
+
* folder.
|
|
168
|
+
*
|
|
169
|
+
* API Endpoint: '/metadata_cascade_policies'
|
|
170
|
+
* Method: POST
|
|
171
|
+
*
|
|
172
|
+
* @param {string} scope Metadata template scope for the template to cascade
|
|
173
|
+
* @param {string} templateKey Metadata template key for the template to cascade
|
|
174
|
+
* @param {string} folderID The ID of the folder to cascade over
|
|
175
|
+
* @param {Function} [callback] Passed the cascade policy if successful
|
|
176
|
+
* @returns {Promise<Object>} Promise resolving to the cascade policy
|
|
177
|
+
*/
|
|
178
|
+
createCascadePolicy(scope: string, templateKey: string, folderID: string, callback?: Function): any;
|
|
179
|
+
/**
|
|
180
|
+
* Delete the metadata cascade policy with the given ID
|
|
181
|
+
*
|
|
182
|
+
* API Endpoint: '/metadata_cascade_policies/:policyID'
|
|
183
|
+
* Method: DELETE
|
|
184
|
+
*
|
|
185
|
+
* @param {string} policyID The ID of the policy to delete
|
|
186
|
+
* @param {Function} [callback] Passed nothing if successful
|
|
187
|
+
* @returns {Promise<void>} Promise resolving to nothing
|
|
188
|
+
*/
|
|
189
|
+
deleteCascadePolicy(policyID: string, callback?: Function): any;
|
|
190
|
+
/**
|
|
191
|
+
* If a policy already exists on a folder, this will apply that policy to all existing files and
|
|
192
|
+
* sub-folders within the target folder.
|
|
193
|
+
*
|
|
194
|
+
* API Endpoint: '/metadata_cascade_policies/:policyID/apply'
|
|
195
|
+
* Method: POST
|
|
196
|
+
*
|
|
197
|
+
* @param {string} policyID The ID of the policy to delete
|
|
198
|
+
* @param {string} resolutionMethod How to resolve conflicts, either "none" or "overwrite"
|
|
199
|
+
* @param {Function} [callback] Passed nothing if successful
|
|
200
|
+
* @returns {Promise<void>} Promise resolving to nothing
|
|
201
|
+
*/
|
|
202
|
+
forceApplyCascadePolicy(policyID: string, resolutionMethod: string, callback?: Function): any;
|
|
203
|
+
/**
|
|
204
|
+
* Query Box items by their metadata
|
|
205
|
+
*
|
|
206
|
+
* API Endpoint: '/metadata_queries/execute_read'
|
|
207
|
+
* Method: POST
|
|
208
|
+
*
|
|
209
|
+
* @param {string} from - The template used in the query. Must be in the form scope.templateKey
|
|
210
|
+
* @param {string} ancestorFolderId - The folder_id to which to restrain the query
|
|
211
|
+
* @param {Object} [options] - Optional parameters
|
|
212
|
+
* @param {string} [options.query] - The logical expression of the query
|
|
213
|
+
* @param {Object} [options.query_parameters] - Required if query present. The arguments for the query
|
|
214
|
+
* @param {string} [options.index_name] - The name of the Index to use
|
|
215
|
+
* @param {Object} [options.order_by] - The field_key(s) to order on and the corresponding direction(s)
|
|
216
|
+
* @param {Array} [options.fields] - An array of fields to return
|
|
217
|
+
* @param {Function} [callback] - Passed a collection of items and their associated metadata
|
|
218
|
+
* @returns {Promise<void>} Promise resolving to a collection of items and their associated metadata
|
|
219
|
+
*/
|
|
220
|
+
query(from: string, ancestorFolderId: string, options?: {
|
|
221
|
+
query?: string;
|
|
222
|
+
query_parameters?: Record<string, any>;
|
|
223
|
+
index_name?: string;
|
|
224
|
+
order_by: Record<string, any>;
|
|
225
|
+
fields?: string[];
|
|
226
|
+
}, callback?: Function): any;
|
|
227
|
+
}
|
|
228
|
+
export = Metadata;
|