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.
Files changed (126) hide show
  1. package/CHANGELOG.md +37 -2
  2. package/README.md +1 -1
  3. package/lib/api-request-manager.d.ts +38 -0
  4. package/lib/api-request-manager.js +48 -55
  5. package/lib/api-request-manager.js.map +1 -0
  6. package/lib/api-request.d.ts +141 -0
  7. package/lib/api-request.js +202 -281
  8. package/lib/api-request.js.map +1 -0
  9. package/lib/box-client.d.ts +269 -0
  10. package/lib/box-client.js +551 -713
  11. package/lib/box-client.js.map +1 -0
  12. package/lib/box-node-sdk.d.ts +216 -0
  13. package/lib/box-node-sdk.js +317 -352
  14. package/lib/box-node-sdk.js.map +1 -0
  15. package/lib/chunked-uploader.d.ts +129 -0
  16. package/lib/chunked-uploader.js +287 -358
  17. package/lib/chunked-uploader.js.map +1 -0
  18. package/lib/enterprise-event-stream.d.ts +82 -0
  19. package/lib/enterprise-event-stream.js +189 -203
  20. package/lib/enterprise-event-stream.js.map +1 -0
  21. package/lib/event-stream.d.ts +92 -0
  22. package/lib/event-stream.js +274 -302
  23. package/lib/event-stream.js.map +1 -0
  24. package/lib/managers/collaboration-allowlist.d.ts +137 -0
  25. package/lib/managers/collaboration-allowlist.js +200 -0
  26. package/lib/managers/collaboration-allowlist.js.map +1 -0
  27. package/lib/managers/collaboration-whitelist.d.ts +3 -0
  28. package/lib/managers/collaboration-whitelist.js +8 -222
  29. package/lib/managers/collaboration-whitelist.js.map +1 -0
  30. package/lib/managers/collaborations.d.ts +166 -0
  31. package/lib/managers/collaborations.js +225 -258
  32. package/lib/managers/collaborations.js.map +1 -0
  33. package/lib/managers/collections.d.ts +42 -0
  34. package/lib/managers/collections.js +45 -50
  35. package/lib/managers/collections.js.map +1 -0
  36. package/lib/managers/comments.d.ts +103 -0
  37. package/lib/managers/comments.js +158 -173
  38. package/lib/managers/comments.js.map +1 -0
  39. package/lib/managers/device-pins.d.ts +52 -0
  40. package/lib/managers/device-pins.js +75 -88
  41. package/lib/managers/device-pins.js.map +1 -0
  42. package/lib/managers/enterprise.d.ts +162 -0
  43. package/lib/managers/enterprise.js +168 -199
  44. package/lib/managers/enterprise.js.map +1 -0
  45. package/lib/managers/events.d.ts +177 -0
  46. package/lib/managers/events.js +230 -254
  47. package/lib/managers/events.js.map +1 -0
  48. package/lib/managers/files.d.ts +772 -0
  49. package/lib/managers/files.js +1400 -1602
  50. package/lib/managers/files.js.map +1 -0
  51. package/lib/managers/folders.d.ts +347 -0
  52. package/lib/managers/folders.js +551 -567
  53. package/lib/managers/folders.js.map +1 -0
  54. package/lib/managers/groups.d.ts +202 -0
  55. package/lib/managers/groups.js +238 -287
  56. package/lib/managers/groups.js.map +1 -0
  57. package/lib/managers/legal-hold-policies.d.ts +190 -0
  58. package/lib/managers/legal-hold-policies.js +228 -272
  59. package/lib/managers/legal-hold-policies.js.map +1 -0
  60. package/lib/managers/metadata.d.ts +228 -0
  61. package/lib/managers/metadata.js +265 -328
  62. package/lib/managers/metadata.js.map +1 -0
  63. package/lib/managers/recent-items.d.ts +38 -0
  64. package/lib/managers/recent-items.js +32 -39
  65. package/lib/managers/recent-items.js.map +1 -0
  66. package/lib/managers/retention-policies.d.ts +213 -0
  67. package/lib/managers/retention-policies.js +235 -281
  68. package/lib/managers/retention-policies.js.map +1 -0
  69. package/lib/managers/search.d.ts +82 -0
  70. package/lib/managers/search.js +68 -88
  71. package/lib/managers/search.js.map +1 -0
  72. package/lib/managers/shared-items.d.ts +33 -0
  73. package/lib/managers/shared-items.js +54 -62
  74. package/lib/managers/shared-items.js.map +1 -0
  75. package/lib/managers/storage-policies.d.ts +86 -0
  76. package/lib/managers/storage-policies.js +108 -142
  77. package/lib/managers/storage-policies.js.map +1 -0
  78. package/lib/managers/tasks.d.ts +161 -0
  79. package/lib/managers/tasks.js +219 -260
  80. package/lib/managers/tasks.js.map +1 -0
  81. package/lib/managers/terms-of-service.d.ts +161 -0
  82. package/lib/managers/terms-of-service.js +250 -273
  83. package/lib/managers/terms-of-service.js.map +1 -0
  84. package/lib/managers/trash.d.ts +30 -0
  85. package/lib/managers/trash.js +30 -41
  86. package/lib/managers/trash.js.map +1 -0
  87. package/lib/managers/users.d.ts +131 -0
  88. package/lib/managers/users.js +160 -203
  89. package/lib/managers/users.js.map +1 -0
  90. package/lib/managers/web-links.d.ts +127 -0
  91. package/lib/managers/web-links.js +183 -209
  92. package/lib/managers/web-links.js.map +1 -0
  93. package/lib/managers/webhooks.d.ts +166 -0
  94. package/lib/managers/webhooks.js +312 -305
  95. package/lib/managers/webhooks.js.map +1 -0
  96. package/lib/sessions/anonymous-session.d.ts +69 -0
  97. package/lib/sessions/anonymous-session.js +88 -102
  98. package/lib/sessions/anonymous-session.js.map +1 -0
  99. package/lib/sessions/app-auth-session.d.ts +92 -0
  100. package/lib/sessions/app-auth-session.js +140 -160
  101. package/lib/sessions/app-auth-session.js.map +1 -0
  102. package/lib/sessions/basic-session.d.ts +56 -0
  103. package/lib/sessions/basic-session.js +40 -50
  104. package/lib/sessions/basic-session.js.map +1 -0
  105. package/lib/sessions/persistent-session.d.ts +96 -0
  106. package/lib/sessions/persistent-session.js +191 -211
  107. package/lib/sessions/persistent-session.js.map +1 -0
  108. package/lib/token-manager.d.ts +191 -0
  109. package/lib/token-manager.js +390 -465
  110. package/lib/token-manager.js.map +1 -0
  111. package/lib/util/config.d.ts +86 -0
  112. package/lib/util/config.js +124 -152
  113. package/lib/util/config.js.map +1 -0
  114. package/lib/util/errors.d.ts +50 -0
  115. package/lib/util/errors.js +134 -145
  116. package/lib/util/errors.js.map +1 -0
  117. package/lib/util/exponential-backoff.d.ts +11 -0
  118. package/lib/util/exponential-backoff.js +10 -22
  119. package/lib/util/exponential-backoff.js.map +1 -0
  120. package/lib/util/paging-iterator.d.ts +53 -0
  121. package/lib/util/paging-iterator.js +202 -218
  122. package/lib/util/paging-iterator.js.map +1 -0
  123. package/lib/util/url-path.d.ts +16 -0
  124. package/lib/util/url-path.js +20 -35
  125. package/lib/util/url-path.js.map +1 -0
  126. package/package.json +24 -9
@@ -1,34 +1,33 @@
1
+ "use strict";
1
2
  /**
2
3
  * @fileoverview Manager for the Legal Hold Policies Resource
3
4
  */
4
-
5
- 'use strict';
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
- * Policy assignment types, which specify what type of object the hold applies to
13
- * @typedef {string} LegalHoldPolicyAssignmentType
13
+ * Enum of valid policy assignment types, which specify what object the policy applies to
14
+ * @readonly
15
+ * @enum {LegalHoldPolicyAssignmentType}
14
16
  */
15
-
16
- // -----------------------------------------------------------------------------
17
- // Requirements
18
- // -----------------------------------------------------------------------------
19
- var urlPath = require('../util/url-path');
20
-
17
+ var LegalHoldPolicyAssignmentType;
18
+ (function (LegalHoldPolicyAssignmentType) {
19
+ LegalHoldPolicyAssignmentType["FOLDER"] = "folder";
20
+ LegalHoldPolicyAssignmentType["USER"] = "user";
21
+ LegalHoldPolicyAssignmentType["FILE"] = "file";
22
+ LegalHoldPolicyAssignmentType["FILE_VERSION"] = "file_version";
23
+ })(LegalHoldPolicyAssignmentType || (LegalHoldPolicyAssignmentType = {}));
21
24
  // -----------------------------------------------------------------------------
22
25
  // Private
23
26
  // -----------------------------------------------------------------------------
24
- var BASE_PATH = '/legal_hold_policies',
25
- ASSIGNMENTS_PATH = '/legal_hold_policy_assignments',
26
- FILE_VERSION_LEGAL_HOLDS_PATH = '/file_version_legal_holds';
27
-
27
+ var BASE_PATH = '/legal_hold_policies', ASSIGNMENTS_PATH = '/legal_hold_policy_assignments', FILE_VERSION_LEGAL_HOLDS_PATH = '/file_version_legal_holds';
28
28
  // -----------------------------------------------------------------------------
29
29
  // Public
30
30
  // -----------------------------------------------------------------------------
31
-
32
31
  /**
33
32
  * Simple manager for interacting with all Legal Holds endpoints and actions.
34
33
  *
@@ -36,264 +35,221 @@ var BASE_PATH = '/legal_hold_policies',
36
35
  * @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
37
36
  * @returns {void}
38
37
  */
39
- function LegalHoldPolicies(client) {
40
- this.client = client;
41
- }
42
-
38
+ var LegalHoldPolicies = /** @class */ (function () {
39
+ function LegalHoldPolicies(client) {
40
+ this.client = client;
41
+ }
42
+ /**
43
+ * Used to create a single legal hold policy for an enterprise
44
+ *
45
+ * API Endpoint: '/legal_hold_policies'
46
+ * Method: POST
47
+ *
48
+ * @param {string} name - The name of the legal hold policy to be created
49
+ * @param {Object} [options] - Additional parameters
50
+ * @param {string} [options.description] - Description of the legal hold policy
51
+ * @param {string} [options.filter_started_at] - Date filter, any Custodian assignments will apply only to file versions created or uploaded inside of the date range
52
+ * @param {string} [options.filter_ended_at] - Date filter, any Custodian assignments will apply only to file versions created or uploaded inside of the date range
53
+ * @param {boolean} [options.is_ongoing] - After initialization, Assignments under this Policy will continue applying to files based on events, indefinitely
54
+ * @param {Function} [callback] - Passed the new policy information if it was acquired successfully, error otherwise
55
+ * @returns {Promise<Object>} A promise resolving to the created policy
56
+ */
57
+ LegalHoldPolicies.prototype.create = function (name, options, callback) {
58
+ var apiPath = url_path_1.default(BASE_PATH), params = {
59
+ body: options || {},
60
+ };
61
+ params.body.policy_name = name;
62
+ return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
63
+ };
64
+ /**
65
+ * Fetches details about a specific legal hold policy
66
+ *
67
+ * API Endpoint: '/legal_hold_policies/:policyID'
68
+ * Method: GET
69
+ *
70
+ * @param {string} policyID - The Box ID of the legal hold policy being requested
71
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
72
+ * @param {Function} [callback] - Passed the policy information if it was acquired successfully, error otherwise
73
+ * @returns {Promise<Object>} A promise resolving to the policy object
74
+ */
75
+ LegalHoldPolicies.prototype.get = function (policyID, options, callback) {
76
+ var apiPath = url_path_1.default(BASE_PATH, policyID), params = {
77
+ qs: options,
78
+ };
79
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
80
+ };
81
+ /**
82
+ * Update or modify a legal hold policy.
83
+ *
84
+ * API Endpoint: '/legal_hold_policies/:policyID'
85
+ * Method: PUT
86
+ *
87
+ * @param {string} policyID - The Box ID of the legal hold policy to update
88
+ * @param {Object} updates - The information to be updated
89
+ * @param {string} [updates.policy_name] - Name of Legal Hold Policy
90
+ * @param {string} [updates.description] - Description of Legal Hold Policy
91
+ * @param {string} [updates.release_notes] - Notes around why the policy was released
92
+ * @param {Function} [callback] - Passed the updated policy information if it was acquired successfully, error otherwise
93
+ * @returns {Promise<Object>} A promise resolving to the updated policy
94
+ */
95
+ LegalHoldPolicies.prototype.update = function (policyID, updates, callback) {
96
+ var apiPath = url_path_1.default(BASE_PATH, policyID), params = {
97
+ body: updates,
98
+ };
99
+ return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
100
+ };
101
+ /**
102
+ * Fetches a list of legal hold policies for the enterprise
103
+ *
104
+ * API Endpoint: '/legal_hold_policies'
105
+ * Method: GET
106
+ *
107
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
108
+ * @param {string} [options.policy_name] - A full or partial name to filter the legal hold policies by
109
+ * @param {int} [options.limit] - Limit result size to this number
110
+ * @param {string} [options.marker] - Paging marker, leave blank to start at the first page
111
+ * @param {Function} [callback] - Passed the policy objects if they were acquired successfully, error otherwise
112
+ * @returns {Promise<Object>} A promise resolving to the collection of policies
113
+ */
114
+ LegalHoldPolicies.prototype.getAll = function (options, callback) {
115
+ var apiPath = url_path_1.default(BASE_PATH), params = {
116
+ qs: options,
117
+ };
118
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
119
+ };
120
+ /**
121
+ * Sends request to delete an existing legal hold policy. Note that this is an
122
+ * asynchronous process - the policy will not be fully deleted yet when the
123
+ * response comes back.
124
+ *
125
+ * API Endpoint: '/legal_hold_policies/:policyID'
126
+ * Method: DELETE
127
+ *
128
+ * @param {string} policyID - The legal hold policy to delete
129
+ * @param {Function} [callback] - Passed nothing if successful, error otherwise
130
+ * @returns {Promise<void>} A promise resolving to nothing
131
+ */
132
+ LegalHoldPolicies.prototype.delete = function (policyID, callback) {
133
+ var apiPath = url_path_1.default(BASE_PATH, policyID);
134
+ return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
135
+ };
136
+ /**
137
+ * Fetch a list of assignments for a given legal hold policy
138
+ *
139
+ * API Endpoint: '/legal_hold_policies/:policyID/assignments'
140
+ * Method: GET
141
+ *
142
+ * @param {string} policyID - The Box ID of the legal hold policy to get assignments for
143
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
144
+ * @param {LegalHoldPolicyAssignmentType} [options.assign_to_type] - Filter assignments of this type only
145
+ * @param {string} [options.assign_to_id] - Filter assignments to this ID only. Note that this will only show assignments applied directly to this entity.
146
+ * @param {Function} [callback] - Passed the assignment objects if they were acquired successfully, error otherwise
147
+ * @returns {Promise<Object>} A promise resolving to the collection of policy assignments
148
+ */
149
+ LegalHoldPolicies.prototype.getAssignments = function (policyID, options, callback) {
150
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH), params = {
151
+ qs: Object.assign({ policy_id: policyID }, options),
152
+ };
153
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
154
+ };
155
+ /**
156
+ * Assign a lehal hold policy to an object
157
+ *
158
+ * API Endpoint: '/legal_hold_policy_assignments
159
+ * Method: POST
160
+ *
161
+ * @param {string} policyID - The ID of the policy to assign
162
+ * @param {LegalHoldPolicyAssignmentType} assignType - The type of object the policy will be assigned to
163
+ * @param {string} assignID - The Box ID of the object to assign the legal hold policy to
164
+ * @param {Function} [callback] - Passed the new assignment object if successful, error otherwise
165
+ * @returns {Promise<Object>} A promise resolving to the created assignment object
166
+ */
167
+ LegalHoldPolicies.prototype.assign = function (policyID, assignType, assignID, callback) {
168
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH), params = {
169
+ body: {
170
+ policy_id: policyID,
171
+ assign_to: {
172
+ type: assignType,
173
+ id: assignID,
174
+ },
175
+ },
176
+ };
177
+ return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
178
+ };
179
+ /**
180
+ * Fetch a specific policy assignment
181
+ *
182
+ * API Endpoint: '/legal_hold_policy_assignments/:assignmentID'
183
+ * Method: GET
184
+ *
185
+ * @param {string} assignmentID - The Box ID of the policy assignment object to fetch
186
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
187
+ * @param {Function} [callback] - Passed the assignment object if it was acquired successfully, error otherwise
188
+ * @returns {Promise<Object>} A promise resolving to the assignment object
189
+ */
190
+ LegalHoldPolicies.prototype.getAssignment = function (assignmentID, options, callback) {
191
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID), params = {
192
+ qs: options,
193
+ };
194
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
195
+ };
196
+ /**
197
+ * Sends request to delete an existing legal hold policy. Note that this is an
198
+ * asynchronous process - the policy will not be fully deleted yet when the
199
+ * response comes back.
200
+ *
201
+ * API Endpoint: '/legal_hold_policy_assignments/:assignmentID'
202
+ * Method: DELETE
203
+ *
204
+ * @param {string} assignmentID - The legal hold policy assignment to delete
205
+ * @param {Function} [callback] - Passed nothing if successful, error otherwise
206
+ * @returns {Promise<void>} A promise resolving to nothing
207
+ */
208
+ LegalHoldPolicies.prototype.deleteAssignment = function (assignmentID, callback) {
209
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID);
210
+ return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
211
+ };
212
+ /**
213
+ * Get the specific legal hold record for a held file version.
214
+ *
215
+ * API Endpoint: '/file_version_legal_holds/:legalHoldID'
216
+ * Method: GET
217
+ *
218
+ * @param {string} legalHoldID - The ID for the file legal hold record to retrieve
219
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
220
+ * @param {Function} [callback] - Pass the file version legal hold record if successful, error otherwise
221
+ * @returns {Promise<Object>} A promise resolving to the legal hold record
222
+ */
223
+ LegalHoldPolicies.prototype.getFileVersionLegalHold = function (legalHoldID, options, callback) {
224
+ var apiPath = url_path_1.default(FILE_VERSION_LEGAL_HOLDS_PATH, legalHoldID), params = {
225
+ qs: options,
226
+ };
227
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
228
+ };
229
+ /**
230
+ * Get a list of legal hold records for held file versions in an enterprise.
231
+ *
232
+ * API Endpoint: '/file_version_legal_holds'
233
+ * Method: GET
234
+ *
235
+ * @param {string} policyID - ID of Legal Hold Policy to get File Version Legal Holds for
236
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
237
+ * @param {Function} [callback] - Pass the file version legal holds records if successful, error otherwise
238
+ * @returns {Promise<Object>} A promise resolving to the collection of all file version legal holds
239
+ */
240
+ LegalHoldPolicies.prototype.getAllFileVersionLegalHolds = function (policyID, options, callback) {
241
+ var apiPath = url_path_1.default(FILE_VERSION_LEGAL_HOLDS_PATH), params = {
242
+ qs: Object.assign({ policy_id: policyID }, options),
243
+ };
244
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
245
+ };
246
+ return LegalHoldPolicies;
247
+ }());
43
248
  /**
44
249
  * Enum of valid policy assignment types, which specify what object the policy applies to
45
250
  * @readonly
46
251
  * @enum {LegalHoldPolicyAssignmentType}
47
252
  */
48
- LegalHoldPolicies.prototype.assignmentTypes = Object.freeze({
49
- FOLDER: 'folder',
50
- USER: 'user',
51
- FILE: 'file',
52
- FILE_VERSION: 'file_version'
53
- });
54
-
55
- /**
56
- * Used to create a single legal hold policy for an enterprise
57
- *
58
- * API Endpoint: '/legal_hold_policies'
59
- * Method: POST
60
- *
61
- * @param {string} name - The name of the legal hold policy to be created
62
- * @param {Object} [options] - Additional parameters
63
- * @param {string} [options.description] - Description of the legal hold policy
64
- * @param {string} [options.filter_started_at] - Date filter, any Custodian assignments will apply only to file versions created or uploaded inside of the date range
65
- * @param {string} [options.filter_ended_at] - Date filter, any Custodian assignments will apply only to file versions created or uploaded inside of the date range
66
- * @param {boolean} [options.is_ongoing] - After initialization, Assignments under this Policy will continue applying to files based on events, indefinitely
67
- * @param {Function} [callback] - Passed the new policy information if it was acquired successfully, error otherwise
68
- * @returns {Promise<Object>} A promise resolving to the created policy
69
- */
70
- LegalHoldPolicies.prototype.create = function(name, options, callback) {
71
- var apiPath = urlPath(BASE_PATH),
72
- params = {
73
- body: options || {}
74
- };
75
-
76
- params.body.policy_name = name;
77
-
78
- return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
79
- };
80
-
81
- /**
82
- * Fetches details about a specific legal hold policy
83
- *
84
- * API Endpoint: '/legal_hold_policies/:policyID'
85
- * Method: GET
86
- *
87
- * @param {string} policyID - The Box ID of the legal hold policy being requested
88
- * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
89
- * @param {Function} [callback] - Passed the policy information if it was acquired successfully, error otherwise
90
- * @returns {Promise<Object>} A promise resolving to the policy object
91
- */
92
- LegalHoldPolicies.prototype.get = function(policyID, options, callback) {
93
- var apiPath = urlPath(BASE_PATH, policyID),
94
- params = {
95
- qs: options
96
- };
97
-
98
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
99
- };
100
-
101
- /**
102
- * Update or modify a legal hold policy.
103
- *
104
- * API Endpoint: '/legal_hold_policies/:policyID'
105
- * Method: PUT
106
- *
107
- * @param {string} policyID - The Box ID of the legal hold policy to update
108
- * @param {Object} updates - The information to be updated
109
- * @param {string} [updates.policy_name] - Name of Legal Hold Policy
110
- * @param {string} [updates.description] - Description of Legal Hold Policy
111
- * @param {string} [updates.release_notes] - Notes around why the policy was released
112
- * @param {Function} [callback] - Passed the updated policy information if it was acquired successfully, error otherwise
113
- * @returns {Promise<Object>} A promise resolving to the updated policy
114
- */
115
- LegalHoldPolicies.prototype.update = function(policyID, updates, callback) {
116
-
117
- var apiPath = urlPath(BASE_PATH, policyID),
118
- params = {
119
- body: updates
120
- };
121
-
122
- return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
123
- };
124
-
125
- /**
126
- * Fetches a list of legal hold policies for the enterprise
127
- *
128
- * API Endpoint: '/legal_hold_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 legal hold policies by
133
- * @param {int} [options.limit] - Limit result size to this number
134
- * @param {string} [options.marker] - Paging marker, leave blank to start at the first page
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
- LegalHoldPolicies.prototype.getAll = function(options, callback) {
139
- var apiPath = urlPath(BASE_PATH),
140
- params = {
141
- qs: options
142
- };
143
-
144
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
145
- };
146
-
147
- /**
148
- * Sends request to delete an existing legal hold policy. Note that this is an
149
- * asynchronous process - the policy will not be fully deleted yet when the
150
- * response comes back.
151
- *
152
- * API Endpoint: '/legal_hold_policies/:policyID'
153
- * Method: DELETE
154
- *
155
- * @param {string} policyID - The legal hold policy to delete
156
- * @param {Function} [callback] - Passed nothing if successful, error otherwise
157
- * @returns {Promise<void>} A promise resolving to nothing
158
- */
159
- LegalHoldPolicies.prototype.delete = function(policyID, callback) {
160
-
161
- var apiPath = urlPath(BASE_PATH, policyID);
162
-
163
- return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
164
- };
165
-
166
- /**
167
- * Fetch a list of assignments for a given legal hold policy
168
- *
169
- * API Endpoint: '/legal_hold_policies/:policyID/assignments'
170
- * Method: GET
171
- *
172
- * @param {string} policyID - The Box ID of the legal hold policy to get assignments for
173
- * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
174
- * @param {LegalHoldPolicyAssignmentType} [options.assign_to_type] - Filter assignments of this type only
175
- * @param {string} [options.assign_to_id] - Filter assignments to this ID only. Note that this will only show assignments applied directly to this entity.
176
- * @param {Function} [callback] - Passed the assignment objects if they were acquired successfully, error otherwise
177
- * @returns {Promise<Object>} A promise resolving to the collection of policy assignments
178
- */
179
- LegalHoldPolicies.prototype.getAssignments = function(policyID, options, callback) {
180
-
181
- var apiPath = urlPath(ASSIGNMENTS_PATH),
182
- params = {
183
- qs: Object.assign({ policy_id: policyID }, options)
184
- };
185
-
186
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
187
- };
188
-
189
- /**
190
- * Assign a lehal hold policy to an object
191
- *
192
- * API Endpoint: '/legal_hold_policy_assignments
193
- * Method: POST
194
- *
195
- * @param {string} policyID - The ID of the policy to assign
196
- * @param {LegalHoldPolicyAssignmentType} assignType - The type of object the policy will be assigned to
197
- * @param {string} assignID - The Box ID of the object to assign the legal hold policy to
198
- * @param {Function} [callback] - Passed the new assignment object if successful, error otherwise
199
- * @returns {Promise<Object>} A promise resolving to the created assignment object
200
- */
201
- LegalHoldPolicies.prototype.assign = function(policyID, assignType, assignID, callback) {
202
-
203
- var apiPath = urlPath(ASSIGNMENTS_PATH),
204
- params = {
205
- body: {
206
- policy_id: policyID,
207
- assign_to: {
208
- type: assignType,
209
- id: assignID
210
- }
211
- }
212
- };
213
-
214
- return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
215
- };
216
-
217
- /**
218
- * Fetch a specific policy assignment
219
- *
220
- * API Endpoint: '/legal_hold_policy_assignments/:assignmentID'
221
- * Method: GET
222
- *
223
- * @param {string} assignmentID - The Box ID of the policy assignment object to fetch
224
- * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
225
- * @param {Function} [callback] - Passed the assignment object if it was acquired successfully, error otherwise
226
- * @returns {Promise<Object>} A promise resolving to the assignment object
227
- */
228
- LegalHoldPolicies.prototype.getAssignment = function(assignmentID, options, callback) {
229
-
230
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID),
231
- params = {
232
- qs: options
233
- };
234
-
235
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
236
- };
237
-
238
- /**
239
- * Sends request to delete an existing legal hold policy. Note that this is an
240
- * asynchronous process - the policy will not be fully deleted yet when the
241
- * response comes back.
242
- *
243
- * API Endpoint: '/legal_hold_policy_assignments/:assignmentID'
244
- * Method: DELETE
245
- *
246
- * @param {string} assignmentID - The legal hold policy assignment to delete
247
- * @param {Function} [callback] - Passed nothing if successful, error otherwise
248
- * @returns {Promise<void>} A promise resolving to nothing
249
- */
250
- LegalHoldPolicies.prototype.deleteAssignment = function(assignmentID, callback) {
251
-
252
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID);
253
-
254
- return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
255
- };
256
-
257
- /**
258
- * Get the specific legal hold record for a held file version.
259
- *
260
- * API Endpoint: '/file_version_legal_holds/:legalHoldID'
261
- * Method: GET
262
- *
263
- * @param {string} legalHoldID - The ID for the file legal hold record to retrieve
264
- * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
265
- * @param {Function} [callback] - Pass the file version legal hold record if successful, error otherwise
266
- * @returns {Promise<Object>} A promise resolving to the legal hold record
267
- */
268
- LegalHoldPolicies.prototype.getFileVersionLegalHold = function(legalHoldID, options, callback) {
269
-
270
- var apiPath = urlPath(FILE_VERSION_LEGAL_HOLDS_PATH, legalHoldID),
271
- params = {
272
- qs: options
273
- };
274
-
275
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
276
- };
277
-
278
- /**
279
- * Get a list of legal hold records for held file versions in an enterprise.
280
- *
281
- * API Endpoint: '/file_version_legal_holds'
282
- * Method: GET
283
- *
284
- * @param {string} policyID - ID of Legal Hold Policy to get File Version Legal Holds for
285
- * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
286
- * @param {Function} [callback] - Pass the file version legal holds records if successful, error otherwise
287
- * @returns {Promise<Object>} A promise resolving to the collection of all file version legal holds
288
- */
289
- LegalHoldPolicies.prototype.getAllFileVersionLegalHolds = function(policyID, options, callback) {
290
-
291
- var apiPath = urlPath(FILE_VERSION_LEGAL_HOLDS_PATH),
292
- params = {
293
- qs: Object.assign({ policy_id: policyID }, options)
294
- };
295
-
296
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
297
- };
298
-
253
+ LegalHoldPolicies.prototype.assignmentTypes = LegalHoldPolicyAssignmentType;
299
254
  module.exports = LegalHoldPolicies;
255
+ //# sourceMappingURL=legal-hold-policies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legal-hold-policies.js","sourceRoot":"","sources":["../../src/managers/legal-hold-policies.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAOH,8DAAuC;AAEvC,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF;;;;GAIG;AACH,IAAK,6BAKJ;AALD,WAAK,6BAA6B;IACjC,kDAAiB,CAAA;IACjB,8CAAa,CAAA;IACb,8CAAa,CAAA;IACb,8DAA6B,CAAA;AAC9B,CAAC,EALI,6BAA6B,KAA7B,6BAA6B,QAKjC;AAED,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,IAAM,SAAS,GAAG,sBAAsB,EACvC,gBAAgB,GAAG,gCAAgC,EACnD,6BAA6B,GAAG,2BAA2B,CAAC;AAE7D,gFAAgF;AAChF,SAAS;AACT,gFAAgF;AAEhF;;;;;;GAMG;AACH;IAIC,2BAAY,MAAiB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,kCAAM,GAAN,UACC,IAAY,EACZ,OAKC,EACD,QAAmB;QAEnB,IAAI,OAAO,GAAG,kBAAO,CAAC,SAAS,CAAC,EAC/B,MAAM,GAAwB;YAC7B,IAAI,EAAE,OAAO,IAAI,EAAE;SACnB,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,WAA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