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
|
@@ -1,54 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @fileoverview Manager for the Retention Policies Resource
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
var url_path_1 = __importDefault(require("../util/url-path"));
|
|
7
9
|
// -----------------------------------------------------------------------------
|
|
8
10
|
// Typedefs
|
|
9
11
|
// -----------------------------------------------------------------------------
|
|
10
|
-
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* remain in effect
|
|
14
|
-
* @
|
|
13
|
+
* Enum of valid retention policy types, which specify how long the policy should
|
|
14
|
+
* remain in effect.
|
|
15
|
+
* @readonly
|
|
16
|
+
* @enum {RetentionPolicyType}
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
var RetentionPolicyType;
|
|
19
|
+
(function (RetentionPolicyType) {
|
|
20
|
+
RetentionPolicyType["FINITE"] = "finite";
|
|
21
|
+
RetentionPolicyType["INDEFINITE"] = "indefinite";
|
|
22
|
+
})(RetentionPolicyType || (RetentionPolicyType = {}));
|
|
17
23
|
/**
|
|
18
|
-
*
|
|
24
|
+
* Enum of valid retention policy disposition actions, which specify what should
|
|
19
25
|
* be done when the retention period is over
|
|
20
|
-
* @
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Policy assignment types, which specify what type of object the policy applies to
|
|
25
|
-
* @typedef {string} RetentionPolicyAssignmentType
|
|
26
|
+
* @readonly
|
|
27
|
+
* @enum {RetentionPolicyDispositionAction}
|
|
26
28
|
*/
|
|
27
|
-
|
|
29
|
+
var RetentionPolicyDispositionAction;
|
|
30
|
+
(function (RetentionPolicyDispositionAction) {
|
|
31
|
+
RetentionPolicyDispositionAction["PERMANENTLY_DELETE"] = "permanently_delete";
|
|
32
|
+
RetentionPolicyDispositionAction["REMOVE_RETENTION"] = "remove_retention";
|
|
33
|
+
})(RetentionPolicyDispositionAction || (RetentionPolicyDispositionAction = {}));
|
|
28
34
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
31
|
-
* @
|
|
32
|
-
* @property {string|int} value The value to filter against
|
|
35
|
+
* Enum of valid policy assignment types, which specify what object the policy applies to
|
|
36
|
+
* @readonly
|
|
37
|
+
* @enum {RetentionPolicyAssignmentType}
|
|
33
38
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
var RetentionPolicyAssignmentType;
|
|
40
|
+
(function (RetentionPolicyAssignmentType) {
|
|
41
|
+
RetentionPolicyAssignmentType["FOLDER"] = "folder";
|
|
42
|
+
RetentionPolicyAssignmentType["ENTERPRISE"] = "enterprise";
|
|
43
|
+
RetentionPolicyAssignmentType["METADATA"] = "metadata_template";
|
|
44
|
+
})(RetentionPolicyAssignmentType || (RetentionPolicyAssignmentType = {}));
|
|
40
45
|
// -----------------------------------------------------------------------------
|
|
41
46
|
// Private
|
|
42
47
|
// -----------------------------------------------------------------------------
|
|
43
|
-
var BASE_PATH = '/retention_policies',
|
|
44
|
-
ASSIGNMENTS_PATH = '/retention_policy_assignments',
|
|
45
|
-
FILE_VERSION_RETENTIONS_PATH = '/file_version_retentions',
|
|
46
|
-
ASSIGNMENTS_SUBRESOURCE = 'assignments';
|
|
47
|
-
|
|
48
|
+
var BASE_PATH = '/retention_policies', ASSIGNMENTS_PATH = '/retention_policy_assignments', FILE_VERSION_RETENTIONS_PATH = '/file_version_retentions', ASSIGNMENTS_SUBRESOURCE = 'assignments';
|
|
48
49
|
// -----------------------------------------------------------------------------
|
|
49
50
|
// Public
|
|
50
51
|
// -----------------------------------------------------------------------------
|
|
51
|
-
|
|
52
52
|
/**
|
|
53
53
|
* Simple manager for interacting with all Retention Policies endpoints and actions.
|
|
54
54
|
*
|
|
@@ -56,270 +56,224 @@ var BASE_PATH = '/retention_policies',
|
|
|
56
56
|
* @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
|
|
57
57
|
* @returns {void}
|
|
58
58
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
var RetentionPolicies = /** @class */ (function () {
|
|
60
|
+
function RetentionPolicies(client) {
|
|
61
|
+
this.client = client;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Used to create a single retention policy for an enterprise
|
|
65
|
+
*
|
|
66
|
+
* API Endpoint: '/retention_policies'
|
|
67
|
+
* Method: POST
|
|
68
|
+
*
|
|
69
|
+
* @param {string} name - The name of the retention policy to be created
|
|
70
|
+
* @param {RetentionPolicyType} type - The type of policy to create
|
|
71
|
+
* @param {RetentionPolicyDispositionAction} action - The disposition action for the new policy
|
|
72
|
+
* @param {Object} [options] - Additional parameters
|
|
73
|
+
* @param {int} [options.retention_length] - For finite policies, the number of days to retain the content
|
|
74
|
+
* @param {Function} [callback] - Passed the new policy information if it was acquired successfully, error otherwise
|
|
75
|
+
* @returns {Promise<Object>} A promise resolving to the new policy object
|
|
76
|
+
*/
|
|
77
|
+
RetentionPolicies.prototype.create = function (name, type, action, options, callback) {
|
|
78
|
+
var apiPath = url_path_1.default(BASE_PATH), params = {
|
|
79
|
+
body: {
|
|
80
|
+
policy_name: name,
|
|
81
|
+
policy_type: type,
|
|
82
|
+
disposition_action: action,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
Object.assign(params.body, options);
|
|
86
|
+
return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Fetches details about a specific retention policy
|
|
90
|
+
*
|
|
91
|
+
* API Endpoint: '/retention_policies/:policyID'
|
|
92
|
+
* Method: GET
|
|
93
|
+
*
|
|
94
|
+
* @param {string} policyID - The Box ID of the retention policy being requested
|
|
95
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
96
|
+
* @param {Function} [callback] - Passed the policy information if it was acquired successfully, error otherwise
|
|
97
|
+
* @returns {Promise<Object>} A promise resolving to the policy object
|
|
98
|
+
*/
|
|
99
|
+
RetentionPolicies.prototype.get = function (policyID, options, callback) {
|
|
100
|
+
var apiPath = url_path_1.default(BASE_PATH, policyID), params = {
|
|
101
|
+
qs: options,
|
|
102
|
+
};
|
|
103
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Update or modify a retention policy.
|
|
107
|
+
*
|
|
108
|
+
* API Endpoint: '/retention_policies/:policyID'
|
|
109
|
+
* Method: PUT
|
|
110
|
+
*
|
|
111
|
+
* @param {string} policyID - The Box ID of the retention policy to update
|
|
112
|
+
* @param {Object} updates - The information to be updated
|
|
113
|
+
* @param {string} [updates.policy_name] - The name of the retention policy
|
|
114
|
+
* @param {RetentionPolicyDispositionAction} [updates.disposition_action] - The disposition action for the updated policy
|
|
115
|
+
* @param {string} [updates.status] - Used to retire a retention policy if status is set to retired
|
|
116
|
+
* @param {Function} [callback] - Passed the updated policy information if it was acquired successfully, error otherwise
|
|
117
|
+
* @returns {Promise<Object>} A promise resolving to the updated policy object
|
|
118
|
+
*/
|
|
119
|
+
RetentionPolicies.prototype.update = function (policyID, updates, callback) {
|
|
120
|
+
var apiPath = url_path_1.default(BASE_PATH, policyID), params = {
|
|
121
|
+
body: updates,
|
|
122
|
+
};
|
|
123
|
+
return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Fetches a list of retention policies for the enterprise
|
|
127
|
+
*
|
|
128
|
+
* API Endpoint: '/retention_policies
|
|
129
|
+
* Method: GET
|
|
130
|
+
*
|
|
131
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
132
|
+
* @param {string} [options.policy_name] - A full or partial name to filter the retention policies by
|
|
133
|
+
* @param {RetentionPolicyType} [options.policy_type] - A policy type to filter the retention policies by
|
|
134
|
+
* @param {string} [options.created_by_user_id] - A user id to filter the retention policies by
|
|
135
|
+
* @param {Function} [callback] - Passed the policy objects if they were acquired successfully, error otherwise
|
|
136
|
+
* @returns {Promise<Object>} A promise resolving to the collection of policies
|
|
137
|
+
*/
|
|
138
|
+
RetentionPolicies.prototype.getAll = function (options, callback) {
|
|
139
|
+
var apiPath = url_path_1.default(BASE_PATH), params = {
|
|
140
|
+
qs: options,
|
|
141
|
+
};
|
|
142
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Fetch a list of assignments for a given retention policy
|
|
146
|
+
*
|
|
147
|
+
* API Endpoint: '/retention_policies/:policyID/assignments'
|
|
148
|
+
* Method: GET
|
|
149
|
+
*
|
|
150
|
+
* @param {string} policyID - The Box ID of the retention policy to get assignments for
|
|
151
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
152
|
+
* @param {RetentionPolicyAssignmentType} [options.type] - The type of the retention policy assignment to retrieve
|
|
153
|
+
* @param {Function} [callback] - Passed the assignment objects if they were acquired successfully, error otherwise
|
|
154
|
+
* @returns {Promise<Object>} A promise resolving to the collection of policy assignments
|
|
155
|
+
*/
|
|
156
|
+
RetentionPolicies.prototype.getAssignments = function (policyID, options, callback) {
|
|
157
|
+
var apiPath = url_path_1.default(BASE_PATH, policyID, ASSIGNMENTS_SUBRESOURCE), params = {
|
|
158
|
+
qs: options,
|
|
159
|
+
};
|
|
160
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Assign a retention policy to a folder or the entire enterprise.
|
|
164
|
+
*
|
|
165
|
+
* API Endpoint: '/retention_policy_assignments
|
|
166
|
+
* Method: POST
|
|
167
|
+
*
|
|
168
|
+
* @param {string} policyID - The ID of the policy to assign
|
|
169
|
+
* @param {RetentionPolicyAssignmentType} assignType - The type of object the policy will be assigned to
|
|
170
|
+
* @param {string} assignID - The Box ID of the object to assign the retention policy to
|
|
171
|
+
* @param {Object} [options] - Optional parameters for the request
|
|
172
|
+
* @param {MetadataFilterField[]} [options.filter_fields] - Metadata fields to filter against, if assigning to a metadata template
|
|
173
|
+
* @param {Function} [callback] - Passed the new assignment object if successful, error otherwise
|
|
174
|
+
* @returns {Promise<Object>} A promise resolving to the created assignment object
|
|
175
|
+
*/
|
|
176
|
+
RetentionPolicies.prototype.assign = function (policyID, assignType, assignID, options, callback) {
|
|
177
|
+
// Shuffle optional arguments
|
|
178
|
+
if (typeof options === 'function') {
|
|
179
|
+
callback = options;
|
|
180
|
+
options = null;
|
|
181
|
+
}
|
|
182
|
+
var apiPath = url_path_1.default(ASSIGNMENTS_PATH), params = {
|
|
183
|
+
body: {
|
|
184
|
+
policy_id: policyID,
|
|
185
|
+
assign_to: {
|
|
186
|
+
type: assignType,
|
|
187
|
+
id: assignID,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
Object.assign(params.body, options);
|
|
192
|
+
return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Fetch a specific policy assignment
|
|
196
|
+
*
|
|
197
|
+
* API Endpoint: '/retention_policy_assignments/:assignmentID'
|
|
198
|
+
* Method: GET
|
|
199
|
+
*
|
|
200
|
+
* @param {string} assignmentID - The Box ID of the policy assignment object to fetch
|
|
201
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
202
|
+
* @param {Function} [callback] - Passed the assignment object if it was acquired successfully, error otherwise
|
|
203
|
+
* @returns {Promise<Object>} A promise resolving to the assignment object
|
|
204
|
+
*/
|
|
205
|
+
RetentionPolicies.prototype.getAssignment = function (assignmentID, options, callback) {
|
|
206
|
+
var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID), params = {
|
|
207
|
+
qs: options,
|
|
208
|
+
};
|
|
209
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Get the specific retention record for a retained file version. To use this feature,
|
|
213
|
+
* you must have the manage retention policies scope enabled for your API key
|
|
214
|
+
* via your application management console.
|
|
215
|
+
*
|
|
216
|
+
* API Endpoint: '/file_version_retentions/:retentionID'
|
|
217
|
+
* Method: GET
|
|
218
|
+
*
|
|
219
|
+
* @param {string} retentionID - The ID for the file retention record to retrieve
|
|
220
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
221
|
+
* @param {Function} [callback] - Pass the file version retention record if successful, error otherwise
|
|
222
|
+
* @returns {Promise<Object>} A promise resolving to the retention record
|
|
223
|
+
*/
|
|
224
|
+
RetentionPolicies.prototype.getFileVersionRetention = function (retentionID, options, callback) {
|
|
225
|
+
var apiPath = url_path_1.default(FILE_VERSION_RETENTIONS_PATH, retentionID), params = {
|
|
226
|
+
qs: options,
|
|
227
|
+
};
|
|
228
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Get a list of retention records for a retained file versions in an enterprise.
|
|
232
|
+
* To use this feature, you must have the manage retention policies scope enabled
|
|
233
|
+
* for your API key via your application management console.
|
|
234
|
+
*
|
|
235
|
+
* API Endpoint: '/file_version_retentions'
|
|
236
|
+
* Method: GET
|
|
237
|
+
*
|
|
238
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
239
|
+
* @param {string} [options.file_id] - A file id to filter the file version retentions by
|
|
240
|
+
* @param {string} [options.file_version_id] - A file version id to filter the file version retentions by
|
|
241
|
+
* @param {string} [options.policy_id] - A policy id to filter the file version retentions by
|
|
242
|
+
* @param {RetentionPolicyDispositionAction} [options.disposition_action] - The disposition action of the retention policy to filter by
|
|
243
|
+
* @param {string} [options.disposition_before] - Filter by retention policies which will complete before a certain time
|
|
244
|
+
* @param {string} [options.disposition_after] - Filter by retention policies which will complete after a certain time
|
|
245
|
+
* @param {int} [options.limit] - The maximum number of items to return in a page
|
|
246
|
+
* @param {string} [options.marker] - Paging marker, left blank to begin paging from the beginning
|
|
247
|
+
* @param {Function} [callback] - Pass the file version retention record if successful, error otherwise
|
|
248
|
+
* @returns {Promise<Object>} A promise resolving to the collection of retention records
|
|
249
|
+
*/
|
|
250
|
+
RetentionPolicies.prototype.getAllFileVersionRetentions = function (options, callback) {
|
|
251
|
+
var apiPath = url_path_1.default(FILE_VERSION_RETENTIONS_PATH), params = {
|
|
252
|
+
qs: options,
|
|
253
|
+
};
|
|
254
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
255
|
+
};
|
|
256
|
+
return RetentionPolicies;
|
|
257
|
+
}());
|
|
63
258
|
/**
|
|
64
259
|
* Enum of valid retention policy types, which specify how long the policy should
|
|
65
260
|
* remain in effect.
|
|
66
261
|
* @readonly
|
|
67
262
|
* @enum {RetentionPolicyType}
|
|
68
263
|
*/
|
|
69
|
-
RetentionPolicies.prototype.policyTypes =
|
|
70
|
-
FINITE: 'finite',
|
|
71
|
-
INDEFINITE: 'indefinite'
|
|
72
|
-
});
|
|
73
|
-
|
|
264
|
+
RetentionPolicies.prototype.policyTypes = RetentionPolicyType;
|
|
74
265
|
/**
|
|
75
266
|
* Enum of valid retention policy disposition actions, which specify what should
|
|
76
267
|
* be done when the retention period is over
|
|
77
268
|
* @readonly
|
|
78
269
|
* @enum {RetentionPolicyDispositionAction}
|
|
79
270
|
*/
|
|
80
|
-
RetentionPolicies.prototype.dispositionActions =
|
|
81
|
-
PERMANENTLY_DELETE: 'permanently_delete',
|
|
82
|
-
REMOVE_RETENTION: 'remove_retention'
|
|
83
|
-
});
|
|
84
|
-
|
|
271
|
+
RetentionPolicies.prototype.dispositionActions = RetentionPolicyDispositionAction;
|
|
85
272
|
/**
|
|
86
273
|
* Enum of valid policy assignment types, which specify what object the policy applies to
|
|
87
274
|
* @readonly
|
|
88
275
|
* @enum {RetentionPolicyAssignmentType}
|
|
89
276
|
*/
|
|
90
|
-
RetentionPolicies.prototype.assignmentTypes =
|
|
91
|
-
FOLDER: 'folder',
|
|
92
|
-
ENTERPRISE: 'enterprise',
|
|
93
|
-
METADATA: 'metadata_template'
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Used to create a single retention policy for an enterprise
|
|
98
|
-
*
|
|
99
|
-
* API Endpoint: '/retention_policies'
|
|
100
|
-
* Method: POST
|
|
101
|
-
*
|
|
102
|
-
* @param {string} name - The name of the retention policy to be created
|
|
103
|
-
* @param {RetentionPolicyType} type - The type of policy to create
|
|
104
|
-
* @param {RetentionPolicyDispositionAction} action - The disposition action for the new policy
|
|
105
|
-
* @param {Object} [options] - Additional parameters
|
|
106
|
-
* @param {int} [options.retention_length] - For finite policies, the number of days to retain the content
|
|
107
|
-
* @param {Function} [callback] - Passed the new policy information if it was acquired successfully, error otherwise
|
|
108
|
-
* @returns {Promise<Object>} A promise resolving to the new policy object
|
|
109
|
-
*/
|
|
110
|
-
RetentionPolicies.prototype.create = function(name, type, action, options, callback) {
|
|
111
|
-
var apiPath = urlPath(BASE_PATH),
|
|
112
|
-
params = {
|
|
113
|
-
body: {
|
|
114
|
-
policy_name: name,
|
|
115
|
-
policy_type: type,
|
|
116
|
-
disposition_action: action
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
Object.assign(params.body, options);
|
|
121
|
-
|
|
122
|
-
return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Fetches details about a specific retention policy
|
|
127
|
-
*
|
|
128
|
-
* API Endpoint: '/retention_policies/:policyID'
|
|
129
|
-
* Method: GET
|
|
130
|
-
*
|
|
131
|
-
* @param {string} policyID - The Box ID of the retention policy being requested
|
|
132
|
-
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
133
|
-
* @param {Function} [callback] - Passed the policy information if it was acquired successfully, error otherwise
|
|
134
|
-
* @returns {Promise<Object>} A promise resolving to the policy object
|
|
135
|
-
*/
|
|
136
|
-
RetentionPolicies.prototype.get = function(policyID, options, callback) {
|
|
137
|
-
var apiPath = urlPath(BASE_PATH, policyID),
|
|
138
|
-
params = {
|
|
139
|
-
qs: options
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Update or modify a retention policy.
|
|
147
|
-
*
|
|
148
|
-
* API Endpoint: '/retention_policies/:policyID'
|
|
149
|
-
* Method: PUT
|
|
150
|
-
*
|
|
151
|
-
* @param {string} policyID - The Box ID of the retention policy to update
|
|
152
|
-
* @param {Object} updates - The information to be updated
|
|
153
|
-
* @param {string} [updates.policy_name] - The name of the retention policy
|
|
154
|
-
* @param {RetentionPolicyDispositionAction} [updates.disposition_action] - The disposition action for the updated policy
|
|
155
|
-
* @param {string} [updates.status] - Used to retire a retention policy if status is set to retired
|
|
156
|
-
* @param {Function} [callback] - Passed the updated policy information if it was acquired successfully, error otherwise
|
|
157
|
-
* @returns {Promise<Object>} A promise resolving to the updated policy object
|
|
158
|
-
*/
|
|
159
|
-
RetentionPolicies.prototype.update = function(policyID, updates, callback) {
|
|
160
|
-
|
|
161
|
-
var apiPath = urlPath(BASE_PATH, policyID),
|
|
162
|
-
params = {
|
|
163
|
-
body: updates
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Fetches a list of retention policies for the enterprise
|
|
171
|
-
*
|
|
172
|
-
* API Endpoint: '/retention_policies
|
|
173
|
-
* Method: GET
|
|
174
|
-
*
|
|
175
|
-
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
176
|
-
* @param {string} [options.policy_name] - A full or partial name to filter the retention policies by
|
|
177
|
-
* @param {RetentionPolicyType} [options.policy_type] - A policy type to filter the retention policies by
|
|
178
|
-
* @param {string} [options.created_by_user_id] - A user id to filter the retention policies by
|
|
179
|
-
* @param {Function} [callback] - Passed the policy objects if they were acquired successfully, error otherwise
|
|
180
|
-
* @returns {Promise<Object>} A promise resolving to the collection of policies
|
|
181
|
-
*/
|
|
182
|
-
RetentionPolicies.prototype.getAll = function(options, callback) {
|
|
183
|
-
var apiPath = urlPath(BASE_PATH),
|
|
184
|
-
params = {
|
|
185
|
-
qs: options
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Fetch a list of assignments for a given retention policy
|
|
193
|
-
*
|
|
194
|
-
* API Endpoint: '/retention_policies/:policyID/assignments'
|
|
195
|
-
* Method: GET
|
|
196
|
-
*
|
|
197
|
-
* @param {string} policyID - The Box ID of the retention policy to get assignments for
|
|
198
|
-
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
199
|
-
* @param {RetentionPolicyAssignmentType} [options.type] - The type of the retention policy assignment to retrieve
|
|
200
|
-
* @param {Function} [callback] - Passed the assignment objects if they were acquired successfully, error otherwise
|
|
201
|
-
* @returns {Promise<Object>} A promise resolving to the collection of policy assignments
|
|
202
|
-
*/
|
|
203
|
-
RetentionPolicies.prototype.getAssignments = function(policyID, options, callback) {
|
|
204
|
-
|
|
205
|
-
var apiPath = urlPath(BASE_PATH, policyID, ASSIGNMENTS_SUBRESOURCE),
|
|
206
|
-
params = {
|
|
207
|
-
qs: options
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Assign a retention policy to a folder or the entire enterprise.
|
|
215
|
-
*
|
|
216
|
-
* API Endpoint: '/retention_policy_assignments
|
|
217
|
-
* Method: POST
|
|
218
|
-
*
|
|
219
|
-
* @param {string} policyID - The ID of the policy to assign
|
|
220
|
-
* @param {RetentionPolicyAssignmentType} assignType - The type of object the policy will be assigned to
|
|
221
|
-
* @param {string} assignID - The Box ID of the object to assign the retention policy to
|
|
222
|
-
* @param {Object} [options] - Optional parameters for the request
|
|
223
|
-
* @param {MetadataFilterField[]} [options.filter_fields] - Metadata fields to filter against, if assigning to a metadata template
|
|
224
|
-
* @param {Function} [callback] - Passed the new assignment object if successful, error otherwise
|
|
225
|
-
* @returns {Promise<Object>} A promise resolving to the created assignment object
|
|
226
|
-
*/
|
|
227
|
-
RetentionPolicies.prototype.assign = function(policyID, assignType, assignID, options, callback) {
|
|
228
|
-
|
|
229
|
-
// Shuffle optional arguments
|
|
230
|
-
if (typeof options === 'function') {
|
|
231
|
-
callback = options;
|
|
232
|
-
options = null;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
var apiPath = urlPath(ASSIGNMENTS_PATH),
|
|
236
|
-
params = {
|
|
237
|
-
body: {
|
|
238
|
-
policy_id: policyID,
|
|
239
|
-
assign_to: {
|
|
240
|
-
type: assignType,
|
|
241
|
-
id: assignID
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
Object.assign(params.body, options);
|
|
247
|
-
|
|
248
|
-
return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Fetch a specific policy assignment
|
|
253
|
-
*
|
|
254
|
-
* API Endpoint: '/retention_policy_assignments/:assignmentID'
|
|
255
|
-
* Method: GET
|
|
256
|
-
*
|
|
257
|
-
* @param {string} assignmentID - The Box ID of the policy assignment object to fetch
|
|
258
|
-
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
259
|
-
* @param {Function} [callback] - Passed the assignment object if it was acquired successfully, error otherwise
|
|
260
|
-
* @returns {Promise<Object>} A promise resolving to the assignment object
|
|
261
|
-
*/
|
|
262
|
-
RetentionPolicies.prototype.getAssignment = function(assignmentID, options, callback) {
|
|
263
|
-
|
|
264
|
-
var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID),
|
|
265
|
-
params = {
|
|
266
|
-
qs: options
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Get the specific retention record for a retained file version. To use this feature,
|
|
274
|
-
* you must have the manage retention policies scope enabled for your API key
|
|
275
|
-
* via your application management console.
|
|
276
|
-
*
|
|
277
|
-
* API Endpoint: '/file_version_retentions/:retentionID'
|
|
278
|
-
* Method: GET
|
|
279
|
-
*
|
|
280
|
-
* @param {string} retentionID - The ID for the file retention record to retrieve
|
|
281
|
-
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
282
|
-
* @param {Function} [callback] - Pass the file version retention record if successful, error otherwise
|
|
283
|
-
* @returns {Promise<Object>} A promise resolving to the retention record
|
|
284
|
-
*/
|
|
285
|
-
RetentionPolicies.prototype.getFileVersionRetention = function(retentionID, options, callback) {
|
|
286
|
-
|
|
287
|
-
var apiPath = urlPath(FILE_VERSION_RETENTIONS_PATH, retentionID),
|
|
288
|
-
params = {
|
|
289
|
-
qs: options
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Get a list of retention records for a retained file versions in an enterprise.
|
|
297
|
-
* To use this feature, you must have the manage retention policies scope enabled
|
|
298
|
-
* for your API key via your application management console.
|
|
299
|
-
*
|
|
300
|
-
* API Endpoint: '/file_version_retentions'
|
|
301
|
-
* Method: GET
|
|
302
|
-
*
|
|
303
|
-
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
304
|
-
* @param {string} [options.file_id] - A file id to filter the file version retentions by
|
|
305
|
-
* @param {string} [options.file_version_id] - A file version id to filter the file version retentions by
|
|
306
|
-
* @param {string} [options.policy_id] - A policy id to filter the file version retentions by
|
|
307
|
-
* @param {RetentionPolicyDispositionAction} [options.disposition_action] - The disposition action of the retention policy to filter by
|
|
308
|
-
* @param {string} [options.disposition_before] - Filter by retention policies which will complete before a certain time
|
|
309
|
-
* @param {string} [options.disposition_after] - Filter by retention policies which will complete after a certain time
|
|
310
|
-
* @param {int} [options.limit] - The maximum number of items to return in a page
|
|
311
|
-
* @param {string} [options.marker] - Paging marker, left blank to begin paging from the beginning
|
|
312
|
-
* @param {Function} [callback] - Pass the file version retention record if successful, error otherwise
|
|
313
|
-
* @returns {Promise<Object>} A promise resolving to the collection of retention records
|
|
314
|
-
*/
|
|
315
|
-
RetentionPolicies.prototype.getAllFileVersionRetentions = function(options, callback) {
|
|
316
|
-
|
|
317
|
-
var apiPath = urlPath(FILE_VERSION_RETENTIONS_PATH),
|
|
318
|
-
params = {
|
|
319
|
-
qs: options
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
323
|
-
};
|
|
324
|
-
|
|
277
|
+
RetentionPolicies.prototype.assignmentTypes = RetentionPolicyAssignmentType;
|
|
325
278
|
module.exports = RetentionPolicies;
|
|
279
|
+
//# sourceMappingURL=retention-policies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention-policies.js","sourceRoot":"","sources":["../../src/managers/retention-policies.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAMH,8DAAuC;AAEvC,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF;;;;;GAKG;AACH,IAAK,mBAGJ;AAHD,WAAK,mBAAmB;IACvB,wCAAiB,CAAA;IACjB,gDAAyB,CAAA;AAC1B,CAAC,EAHI,mBAAmB,KAAnB,mBAAmB,QAGvB;AAED;;;;;GAKG;AACH,IAAK,gCAGJ;AAHD,WAAK,gCAAgC;IACpC,6EAAyC,CAAA;IACzC,yEAAqC,CAAA;AACtC,CAAC,EAHI,gCAAgC,KAAhC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G;IACH,uDAA2B,GAA3B,UACC,OASC,EACD,QAAmB;QAEnB,IAAI,OAAO,GAAG,kBAAO,CAAC,4BAA4B,CAAC,EAClD,MAAM,GAAG;YACR,EAAE,EAAE,OAAO;SACX,CAAC;QAEH,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CACzD,OAAO,EACP,MAAM,EACN,QAAQ,CACR,CAAC;IACH,CAAC;IACF,wBAAC;AAAD,CAAC,AAzUD,IAyUC;AAED;;;;;GAKG;AACH,iBAAiB,CAAC,SAAS,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAE9D;;;;;GAKG;AACH,iBAAiB,CAAC,SAAS,CAAC,kBAAkB,GAAG,gCAAgC,CAAC;AAElF;;;;GAIG;AACH,iBAAiB,CAAC,SAAS,CAAC,eAAe,GAAG,6BAA6B,CAAC;AAE5E,iBAAS,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Manager for the Box Search Resource
|
|
3
|
+
*/
|
|
4
|
+
import BoxClient from '../box-client';
|
|
5
|
+
/**
|
|
6
|
+
* Search metadata filter
|
|
7
|
+
* @typedef {Object} SearchMetadataFilter
|
|
8
|
+
* @property {string} templateKey The template to filter against
|
|
9
|
+
* @property {string} scope The scope of the template, e.g. 'global' or 'enterprise'
|
|
10
|
+
* @property {Object} filters Key/value filters against individual metadata template properties
|
|
11
|
+
*/
|
|
12
|
+
declare type SearchMetadataFilter = {
|
|
13
|
+
templateKey: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
filters: Record<string, any>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Valid search scopes
|
|
19
|
+
* @readonly
|
|
20
|
+
* @enum {SearchScope}
|
|
21
|
+
*/
|
|
22
|
+
declare enum SearchScope {
|
|
23
|
+
USER = "user_content",
|
|
24
|
+
ENTERPRISE = "enterprise_content"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Simple manager for interacting with the search endpoints and actions.
|
|
28
|
+
*
|
|
29
|
+
* @constructor
|
|
30
|
+
* @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
|
|
31
|
+
* @returns {void}
|
|
32
|
+
*/
|
|
33
|
+
declare class Search {
|
|
34
|
+
client: BoxClient;
|
|
35
|
+
scopes: typeof SearchScope;
|
|
36
|
+
constructor(client: BoxClient);
|
|
37
|
+
/**
|
|
38
|
+
* Searches Box for the given query.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} searchString - The query string to use for search
|
|
41
|
+
* @param {Object} [options] - Additional search filters. Can be left null in most cases.
|
|
42
|
+
* @param {SearchScope} [options.scope] - The scope on which you want search. Can be user_content for a search limited to the current user or enterprise_content to search an entire enterprise
|
|
43
|
+
* @param {string} [options.file_extensions] - Single or comma-delimited list of file extensions to filter against
|
|
44
|
+
* @param {string} [options.created_at_range] - Date range for filtering on item creation time, e.g. '2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00'
|
|
45
|
+
* @param {string} [options.updated_at_range] - Date range for filtering on item update time, e.g. '2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00'
|
|
46
|
+
* @param {string} [options.size_range] - Range of item sizes (in bytes) to filter on, as lower_bound,upper_bound. Either bound can be ommitted, e.g. ',100000' for <= 100KB
|
|
47
|
+
* @param {string} [options.owner_user_ids] - Comma-delimited list of user IDs to filter item owner against
|
|
48
|
+
* @param {string} [options.ancestor_folder_ids] - Comma-delimited list of folder IDs, search results will contain only items in these folders (and folders within them)
|
|
49
|
+
* @param {string} [options.content_types] - Query within specified comma-delimited fields. The types can be name, description, file_content, comments, or tags
|
|
50
|
+
* @param {string} [options.type] - The type of objects you want to include in the search results. The type can be file, folder, or web_link
|
|
51
|
+
* @param {string} [options.trash_content=non_trashed_only] - Controls whether to search in the trash. The value can be trashed_only or non_trashed_only
|
|
52
|
+
* @param {SearchMetadataFilter[]} [options.mdfilters] - Searches for objects with a specific metadata object association. Searches with the this parameter do not require a query string
|
|
53
|
+
* @param {boolean} [options.include_recent_shared_links] - Determines whether to include items accessible only via shared link in the response.
|
|
54
|
+
* @param {string} [options.fields] - Comma-delimited list of fields to be included in the response
|
|
55
|
+
* @param {int} [options.limit=30] - The number of search results to return, max 200
|
|
56
|
+
* @param {int} [options.offset=0] - The search result at which to start the response, must be a multiple of limit
|
|
57
|
+
* @param {string} [options.sort] - The field on which the results should be sorted, e.g. "modified_at"
|
|
58
|
+
* @param {string} [options.direction] - The sort direction: "ASC" for ascending and "DESC" for descending
|
|
59
|
+
* @param {APIRequest~Callback} [callback] - passed the new comment data if it was posted successfully
|
|
60
|
+
* @returns {Promise<Object>} A promise resolving to the collection of search results
|
|
61
|
+
*/
|
|
62
|
+
query(searchString: string, options?: {
|
|
63
|
+
scope?: SearchScope;
|
|
64
|
+
file_extensions?: string;
|
|
65
|
+
created_at_range?: string;
|
|
66
|
+
updated_at_range?: string;
|
|
67
|
+
size_range?: string;
|
|
68
|
+
owner_user_ids?: string;
|
|
69
|
+
ancestor_folder_ids?: string;
|
|
70
|
+
content_types?: string;
|
|
71
|
+
type?: string;
|
|
72
|
+
trash_content?: string;
|
|
73
|
+
mdfilters?: SearchMetadataFilter[];
|
|
74
|
+
include_recent_shared_links?: boolean;
|
|
75
|
+
fields?: string;
|
|
76
|
+
limit?: number;
|
|
77
|
+
offset?: number;
|
|
78
|
+
sort?: string;
|
|
79
|
+
direction?: string;
|
|
80
|
+
}, callback?: Function): any;
|
|
81
|
+
}
|
|
82
|
+
export = Search;
|