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,32 +1,33 @@
1
+ "use strict";
1
2
  /**
2
3
  * @fileoverview Manager for the Tasks 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
- /** @typedef {string} TaskResolutionState */
12
-
13
- // -----------------------------------------------------------------------------
14
- // Requirements
15
- // -----------------------------------------------------------------------------
16
- var urlPath = require('../util/url-path');
17
-
12
+ /**
13
+ * Enum of valid task resolution states
14
+ * @readonly
15
+ * @enum {TaskResolutionState}
16
+ */
17
+ var TaskResolutionState;
18
+ (function (TaskResolutionState) {
19
+ TaskResolutionState["COMPLETE"] = "completed";
20
+ TaskResolutionState["INCOMPLETE"] = "incomplete";
21
+ TaskResolutionState["APPROVED"] = "approved";
22
+ TaskResolutionState["REJECTED"] = "rejected";
23
+ })(TaskResolutionState || (TaskResolutionState = {}));
18
24
  // -----------------------------------------------------------------------------
19
25
  // Private
20
26
  // -----------------------------------------------------------------------------
21
- var BASE_PATH = '/tasks',
22
- ASSIGNMENTS_SUBRESOURCE = 'assignments',
23
- ASSIGNMENTS_PATH = '/task_assignments',
24
- REVIEW_ACTION = 'review';
25
-
27
+ var BASE_PATH = '/tasks', ASSIGNMENTS_SUBRESOURCE = 'assignments', ASSIGNMENTS_PATH = '/task_assignments', REVIEW_ACTION = 'review';
26
28
  // -----------------------------------------------------------------------------
27
29
  // Public
28
30
  // -----------------------------------------------------------------------------
29
-
30
31
  /**
31
32
  * Simple manager for interacting with all 'Tasks' endpoints and actions.
32
33
  *
@@ -34,252 +35,210 @@ var BASE_PATH = '/tasks',
34
35
  * @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
35
36
  * @returns {void}
36
37
  */
37
- function Tasks(client) {
38
- this.client = client;
39
- }
40
-
38
+ var Tasks = /** @class */ (function () {
39
+ function Tasks(client) {
40
+ this.client = client;
41
+ }
42
+ /**
43
+ * Used to create a single task for single user on a single file.
44
+ *
45
+ * API Endpoint: '/tasks'
46
+ * Method: POST
47
+ *
48
+ * @param {string} fileID - The ID of the item this task is for
49
+ * @param {Object} [options] - Additional parameters
50
+ * @param {string} [options.message] - An optional message to include with the task
51
+ * @param {string} [options.due_at] - The day at which this task is due
52
+ * @param {Function} [callback] - Passed the new task information if it was acquired successfully, error otherwise
53
+ * @returns {Promise<Object>} A promise resolving to the created task object
54
+ */
55
+ Tasks.prototype.create = function (fileID, options, callback) {
56
+ var apiPath = url_path_1.default(BASE_PATH), params = {
57
+ body: {
58
+ item: {
59
+ type: 'file',
60
+ id: fileID,
61
+ },
62
+ action: REVIEW_ACTION,
63
+ },
64
+ };
65
+ Object.assign(params.body, options);
66
+ return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
67
+ };
68
+ /**
69
+ * Fetches a specific task.
70
+ *
71
+ * API Endpoint: '/tasks/:taskID'
72
+ * Method: GET
73
+ *
74
+ * @param {string} taskID - The Box ID of the task being requested
75
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
76
+ * @param {Function} [callback] - Passed the task information if it was acquired successfully, error otherwise
77
+ * @returns {Promise<Object>} A promise resolving to the task object
78
+ */
79
+ Tasks.prototype.get = function (taskID, options, callback) {
80
+ var apiPath = url_path_1.default(BASE_PATH, taskID), params = {
81
+ qs: options,
82
+ };
83
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
84
+ };
85
+ /**
86
+ * Updates a specific task.
87
+ *
88
+ * API Endpoint: '/tasks/:taskID'
89
+ * Method: PUT
90
+ *
91
+ * @param {string} taskID - The Box ID of the task being updated
92
+ * @param {Object} updates - Fields of the task object to update
93
+ * @param {string} [updates.message] - An optional message to include with the task
94
+ * @param {string} [updates.due_at] - The day at which this task is due
95
+ * @param {Function} [callback] - Passed the updated task information if it was acquired successfully, error otherwise
96
+ * @returns {Promise<Object>} A promise resolving to the updated task object
97
+ */
98
+ Tasks.prototype.update = function (taskID, updates, callback) {
99
+ var apiPath = url_path_1.default(BASE_PATH, taskID), params = {
100
+ body: updates,
101
+ };
102
+ return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
103
+ };
104
+ /**
105
+ * Permanently deletes a specific task.
106
+ *
107
+ * API Endpoint: '/tasks/:taskID'
108
+ * Method: DELETE
109
+ *
110
+ * @param {string} taskID - The Box ID of the task being deleted
111
+ * @param {Function} [callback] - Empty body passed if successful, error otherwise
112
+ * @returns {Promise<void>} A promise resolving to nothing
113
+ */
114
+ Tasks.prototype.delete = function (taskID, callback) {
115
+ var apiPath = url_path_1.default(BASE_PATH, taskID);
116
+ return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
117
+ };
118
+ /**
119
+ * Get a list of assignments for a given task
120
+ *
121
+ * API Endpoint: '/tasks/:taskID/assignments'
122
+ * Method: GET
123
+ *
124
+ * @param {string} taskID - The Box ID of the task to get assignments for
125
+ * @param {Object} [options] - Additional parameters, can be left null in most cases
126
+ * @param {Function} [callback] - Passed the list of assignments if successful, error otherwise
127
+ * @returns {Promise<Object>} A promise resolving to the collection of assignment objects
128
+ */
129
+ Tasks.prototype.getAssignments = function (taskID, options, callback) {
130
+ var apiPath = url_path_1.default(BASE_PATH, taskID, ASSIGNMENTS_SUBRESOURCE), params = {
131
+ qs: options,
132
+ };
133
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
134
+ };
135
+ /**
136
+ * Get a specific task assignment
137
+ *
138
+ * API Endpoint: '/task_assignments/:assignmentID'
139
+ * Method: GET
140
+ *
141
+ * @param {string} assignmentID - The Box ID of the task assignment to retrieve
142
+ * @param {Object} [options] - Additional parameters, can be left null in most cases
143
+ * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
144
+ * @returns {Promise<Object>} A promise resolving to the assignment object
145
+ */
146
+ Tasks.prototype.getAssignment = function (assignmentID, options, callback) {
147
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID), params = {
148
+ qs: options,
149
+ };
150
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
151
+ };
152
+ /**
153
+ * Assign a task to a specific user by ID
154
+ *
155
+ * API Endpoint: '/task_assignments'
156
+ * Method: POST
157
+ *
158
+ * @param {string} taskID - The Box ID of the task to assign
159
+ * @param {string} userID - The ID of the user to assign the task to
160
+ * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
161
+ * @returns {Promise<Object>} A promise resolving to the new assignment object
162
+ */
163
+ Tasks.prototype.assignByUserID = function (taskID, userID, callback) {
164
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH), params = {
165
+ body: {
166
+ task: {
167
+ type: 'task',
168
+ id: taskID,
169
+ },
170
+ assign_to: {
171
+ id: userID,
172
+ },
173
+ },
174
+ };
175
+ return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
176
+ };
177
+ /**
178
+ * Assign a task to a specific user by email address
179
+ *
180
+ * API Endpoint: '/task_assignments'
181
+ * Method: POST
182
+ *
183
+ * @param {string} taskID - The Box ID of the task to assign
184
+ * @param {string} email - The email address of the user to assign the task to
185
+ * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
186
+ * @returns {Promise<Object>} A promise resolving to the new assignment object
187
+ */
188
+ Tasks.prototype.assignByEmail = function (taskID, email, callback) {
189
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH), params = {
190
+ body: {
191
+ task: {
192
+ type: 'task',
193
+ id: taskID,
194
+ },
195
+ assign_to: {
196
+ login: email,
197
+ },
198
+ },
199
+ };
200
+ return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
201
+ };
202
+ /**
203
+ * Update a task assignment. This is used to resolve or complete a task.
204
+ *
205
+ * API Endpoint: '/task_assignments/:assignmentID'
206
+ * Method: PUT
207
+ *
208
+ * @param {string} assignmentID - The Box ID of the task assignment to update
209
+ * @param {Object} options - The fields of the assignment to update
210
+ * @param {string} [options.message] - A message from the assignee about this task
211
+ * @param {TaskResolutionState} [options.resolution_state] - Resolution of the task
212
+ * @param {Function} [callback] - Passed the updated task assignment if successful, error otherwise
213
+ * @returns {Promise<Object>} A promise resolving to the updated assignment object
214
+ */
215
+ Tasks.prototype.updateAssignment = function (assignmentID, options, callback) {
216
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID), params = {
217
+ body: options,
218
+ };
219
+ return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
220
+ };
221
+ /**
222
+ * Delete a task assignment. This unassigns a user from the related task.
223
+ *
224
+ * API Endpoint: '/task_assignments/:assignmentID'
225
+ * Method: DELETE
226
+ *
227
+ * @param {string} assignmentID - The Box ID of the task assignment to delete
228
+ * @param {Function} [callback] - Passed nothing if successful, error otherwise
229
+ * @returns {Promise<void>} A promise resolving to nothing
230
+ */
231
+ Tasks.prototype.deleteAssignment = function (assignmentID, callback) {
232
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID);
233
+ return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
234
+ };
235
+ return Tasks;
236
+ }());
41
237
  /**
42
238
  * Enum of valid task resolution states
43
239
  * @readonly
44
240
  * @enum {TaskResolutionState}
45
241
  */
46
- Tasks.prototype.resolutionStates = Object.freeze({
47
- COMPLETE: 'completed',
48
- INCOMPLETE: 'incomplete',
49
- APPROVED: 'approved',
50
- REJECTED: 'rejected'
51
- });
52
-
53
- /**
54
- * Used to create a single task for single user on a single file.
55
- *
56
- * API Endpoint: '/tasks'
57
- * Method: POST
58
- *
59
- * @param {string} fileID - The ID of the item this task is for
60
- * @param {Object} [options] - Additional parameters
61
- * @param {string} [options.message] - An optional message to include with the task
62
- * @param {string} [options.due_at] - The day at which this task is due
63
- * @param {Function} [callback] - Passed the new task information if it was acquired successfully, error otherwise
64
- * @returns {Promise<Object>} A promise resolving to the created task object
65
- */
66
- Tasks.prototype.create = function(fileID, options, callback) {
67
-
68
- var apiPath = urlPath(BASE_PATH),
69
- params = {
70
- body: {
71
- item: {
72
- type: 'file',
73
- id: fileID
74
- },
75
- action: REVIEW_ACTION
76
- }
77
- };
78
-
79
- Object.assign(params.body, options);
80
-
81
- return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
82
- };
83
-
84
- /**
85
- * Fetches a specific task.
86
- *
87
- * API Endpoint: '/tasks/:taskID'
88
- * Method: GET
89
- *
90
- * @param {string} taskID - The Box ID of the task being requested
91
- * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
92
- * @param {Function} [callback] - Passed the task information if it was acquired successfully, error otherwise
93
- * @returns {Promise<Object>} A promise resolving to the task object
94
- */
95
- Tasks.prototype.get = function(taskID, options, callback) {
96
-
97
- var apiPath = urlPath(BASE_PATH, taskID),
98
- params = {
99
- qs: options
100
- };
101
-
102
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
103
- };
104
-
105
- /**
106
- * Updates a specific task.
107
- *
108
- * API Endpoint: '/tasks/:taskID'
109
- * Method: PUT
110
- *
111
- * @param {string} taskID - The Box ID of the task being updated
112
- * @param {Object} updates - Fields of the task object to update
113
- * @param {string} [updates.message] - An optional message to include with the task
114
- * @param {string} [updates.due_at] - The day at which this task is due
115
- * @param {Function} [callback] - Passed the updated task information if it was acquired successfully, error otherwise
116
- * @returns {Promise<Object>} A promise resolving to the updated task object
117
- */
118
- Tasks.prototype.update = function(taskID, updates, callback) {
119
-
120
- var apiPath = urlPath(BASE_PATH, taskID),
121
- params = {
122
- body: updates
123
- };
124
-
125
- return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
126
- };
127
-
128
- /**
129
- * Permanently deletes a specific task.
130
- *
131
- * API Endpoint: '/tasks/:taskID'
132
- * Method: DELETE
133
- *
134
- * @param {string} taskID - The Box ID of the task being deleted
135
- * @param {Function} [callback] - Empty body passed if successful, error otherwise
136
- * @returns {Promise<void>} A promise resolving to nothing
137
- */
138
- Tasks.prototype.delete = function(taskID, callback) {
139
-
140
- var apiPath = urlPath(BASE_PATH, taskID);
141
-
142
- return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
143
- };
144
-
145
- /**
146
- * Get a list of assignments for a given task
147
- *
148
- * API Endpoint: '/tasks/:taskID/assignments'
149
- * Method: GET
150
- *
151
- * @param {string} taskID - The Box ID of the task to get assignments for
152
- * @param {Object} [options] - Additional parameters, can be left null in most cases
153
- * @param {Function} [callback] - Passed the list of assignments if successful, error otherwise
154
- * @returns {Promise<Object>} A promise resolving to the collection of assignment objects
155
- */
156
- Tasks.prototype.getAssignments = function(taskID, options, callback) {
157
-
158
- var apiPath = urlPath(BASE_PATH, taskID, ASSIGNMENTS_SUBRESOURCE),
159
- params = {
160
- qs: options
161
- };
162
-
163
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
164
- };
165
-
166
- /**
167
- * Get a specific task assignment
168
- *
169
- * API Endpoint: '/task_assignments/:assignmentID'
170
- * Method: GET
171
- *
172
- * @param {string} assignmentID - The Box ID of the task assignment to retrieve
173
- * @param {Object} [options] - Additional parameters, can be left null in most cases
174
- * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
175
- * @returns {Promise<Object>} A promise resolving to the assignment object
176
- */
177
- Tasks.prototype.getAssignment = function(assignmentID, options, callback) {
178
-
179
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID),
180
- params = {
181
- qs: options
182
- };
183
-
184
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
185
- };
186
-
187
- /**
188
- * Assign a task to a specific user by ID
189
- *
190
- * API Endpoint: '/task_assignments'
191
- * Method: POST
192
- *
193
- * @param {string} taskID - The Box ID of the task to assign
194
- * @param {string} userID - The ID of the user to assign the task to
195
- * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
196
- * @returns {Promise<Object>} A promise resolving to the new assignment object
197
- */
198
- Tasks.prototype.assignByUserID = function(taskID, userID, callback) {
199
-
200
- var apiPath = urlPath(ASSIGNMENTS_PATH),
201
- params = {
202
- body: {
203
- task: {
204
- type: 'task',
205
- id: taskID
206
- },
207
- assign_to: {
208
- id: userID
209
- }
210
- }
211
- };
212
-
213
- return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
214
- };
215
-
216
- /**
217
- * Assign a task to a specific user by email address
218
- *
219
- * API Endpoint: '/task_assignments'
220
- * Method: POST
221
- *
222
- * @param {string} taskID - The Box ID of the task to assign
223
- * @param {string} email - The email address of the user to assign the task to
224
- * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
225
- * @returns {Promise<Object>} A promise resolving to the new assignment object
226
- */
227
- Tasks.prototype.assignByEmail = function(taskID, email, callback) {
228
-
229
- var apiPath = urlPath(ASSIGNMENTS_PATH),
230
- params = {
231
- body: {
232
- task: {
233
- type: 'task',
234
- id: taskID
235
- },
236
- assign_to: {
237
- login: email
238
- }
239
- }
240
- };
241
-
242
- return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
243
- };
244
-
245
- /**
246
- * Update a task assignment. This is used to resolve or complete a task.
247
- *
248
- * API Endpoint: '/task_assignments/:assignmentID'
249
- * Method: PUT
250
- *
251
- * @param {string} assignmentID - The Box ID of the task assignment to update
252
- * @param {Object} options - The fields of the assignment to update
253
- * @param {string} [options.message] - A message from the assignee about this task
254
- * @param {TaskResolutionState} [options.resolution_state] - Resolution of the task
255
- * @param {Function} [callback] - Passed the updated task assignment if successful, error otherwise
256
- * @returns {Promise<Object>} A promise resolving to the updated assignment object
257
- */
258
- Tasks.prototype.updateAssignment = function(assignmentID, options, callback) {
259
-
260
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID),
261
- params = {
262
- body: options
263
- };
264
-
265
- return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
266
- };
267
-
268
- /**
269
- * Delete a task assignment. This unassigns a user from the related task.
270
- *
271
- * API Endpoint: '/task_assignments/:assignmentID'
272
- * Method: DELETE
273
- *
274
- * @param {string} assignmentID - The Box ID of the task assignment to delete
275
- * @param {Function} [callback] - Passed nothing if successful, error otherwise
276
- * @returns {Promise<void>} A promise resolving to nothing
277
- */
278
- Tasks.prototype.deleteAssignment = function(assignmentID, callback) {
279
-
280
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID);
281
-
282
- return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
283
- };
284
-
242
+ Tasks.prototype.resolutionStates = TaskResolutionState;
285
243
  module.exports = Tasks;
244
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/managers/tasks.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAOH,8DAAuC;AAEvC,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF;;;;GAIG;AACH,IAAK,mBAKJ;AALD,WAAK,mBAAmB;IACvB,6CAAsB,CAAA;IACtB,gDAAyB,CAAA;IACzB,4CAAqB,CAAA;IACrB,4CAAqB,CAAA;AACtB,CAAC,EALI,mBAAmB,KAAnB,mBAAmB,QAKvB;AAED,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,IAAM,SAAS,GAAG,QAAQ,EACzB,uBAAuB,GAAG,aAAa,EACvC,gBAAgB,GAAG,mBAAmB,EACtC,aAAa,GAAG,QAAQ,CAAC;AAE1B,gFAAgF;AAChF,SAAS;AACT,gFAAgF;AAEhF;;;;;;GAMG;AACH;IAKC,eAAY,MAAiB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,sBAAM,GAAN,UACC,MAAc,EACd,OAGC,EACD,QAAmB;QAEnB,IAAI,OAAO,GAAG,kBAAO,CAAC,SAAS,CAAC,EAC/B,MAAM,GAAG;YACR,IAAI,EAAE;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Client from '../box-client';
5
+ /**
6
+ * Enum value of scope of the custom terms of services set to either managed by an enterprise or enternal to an enterprise
7
+ *
8
+ * @readonly
9
+ * @enum {TermsOfServicesType}
10
+ */
11
+ declare enum TermsOfServicesType {
12
+ MANAGED = "managed",
13
+ EXTERNAL = "external"
14
+ }
15
+ /**
16
+ * Enum value of status of the custom terms of services, either currently enabled or currently disabled
17
+ *
18
+ * @readonly
19
+ * @enum {TermsOfServicesStatus}
20
+ */
21
+ declare enum TermsOfServicesStatus {
22
+ ENABLED = "enabled",
23
+ DISABLED = "disabled"
24
+ }
25
+ /**
26
+ * Simple manager for interacting with all 'Terms of Services' and 'Terms of Service User Statuses' endpoints and actions.
27
+ *
28
+ * @param {BoxClient} client The Box API Client that is responsible for making calls to the API
29
+ * @constructor
30
+ */
31
+ declare class TermsOfService {
32
+ client: BoxClient;
33
+ type: typeof TermsOfServicesType;
34
+ status: typeof TermsOfServicesStatus;
35
+ constructor(client: BoxClient);
36
+ /**
37
+ * Creates a custom terms of services with user specified values
38
+ *
39
+ * API Endpoint: '/terms_of_services'
40
+ * Method: POST
41
+ *
42
+ * @param {TermsOfServicesType} termsOfServicesType - Determine if the custom terms of service is scoped internall or externally to an enterprise
43
+ * @param {TermsOfServicesStatus} termsOfServicesStatus - Determine if the custom terms of service is enabled or disabled
44
+ * @param {string} termsOfServicesText - Text field for message associated with custom terms of services
45
+ * @param {Function} [callback] - Passed the terms of services information if successful, error otherwise
46
+ * @returns {Promise<Object>} A promise resolving to the terms of services object
47
+ */
48
+ create(termsOfServicesType: TermsOfServicesType, termsOfServicesStatus: TermsOfServicesStatus, termsOfServicesText: string, callback?: Function): any;
49
+ /**
50
+ * Updates a custom terms of services with new specified values
51
+ *
52
+ * API Endpoint: '/terms_of_services/:termsOfServicesID'
53
+ * Method: PUT
54
+ *
55
+ * @param {string} termsOfServicesID - The id of the custom terms of services to update
56
+ * @param {Object} updates - Fields ot the Terms of Service to update
57
+ * @param {TermsOfServicesStatus} [updates.status] - Determine if the custom terms of service is scoped internall or externally to an enterprise
58
+ * @param {string} [updates.text] - Text field for message associated with custom terms of services
59
+ * @param {Function} [callback] - Passed the terms of services updated information if successful, error otherwise
60
+ * @returns {Promise<Object>} A promise resolving to the terms of services object
61
+ */
62
+ update(termsOfServicesID: string, updates: {
63
+ status?: TermsOfServicesStatus;
64
+ text?: string;
65
+ }, callback?: Function): any;
66
+ /**
67
+ * Gets a specific custom terms of services with specified ID
68
+ *
69
+ * API Endpoint: '/terms_of_services/:termsOfServicesID'
70
+ * Method: GET
71
+ *
72
+ * @param {string} termsOfServicesID - The id of the custom terms of services to retrieve
73
+ * @param {Object} [options] - Additional options. Can be left null in most cases.
74
+ * @param {string} [options.fields] - Comma-separated list of fields to return on the collaboration objects
75
+ * @param {Function} [callback] - Passed the terms of services information with specified ID if successful, error otherwise
76
+ * @returns {Promise<Object>} A promise resolving to the terms of services object
77
+ */
78
+ get(termsOfServicesID: string, options?: {
79
+ fields?: string;
80
+ }, callback?: Function): any;
81
+ /**
82
+ * Gets custom terms of services for the user's enterprise
83
+ *
84
+ * API Endpoint: '/terms_of_services'
85
+ * Method: GET
86
+ *
87
+ * @param {Object} [options] - Additional options. Can be left null in most cases.
88
+ * @param {TermsOfServiceType} [options.tos_type] - Optional, indicates whether the terms of service is set for external or managed under enterprise
89
+ * @param {string} [options.fields] - Comma-separated list of fields to return on the collaboration objects
90
+ * @param {Function} [callback] - Passed the terms of services information if successful, error otherwise
91
+ * @returns {Promise<Object>} A promise resolving to the terms of services object
92
+ */
93
+ getAll(options?: {
94
+ tos_type?: TermsOfServicesType;
95
+ fields?: string;
96
+ }, callback?: Function): any;
97
+ /**
98
+ * Accepts/rejects custom terms of services for the user
99
+ *
100
+ * API Endpoint: '/terms_of_service_user_statuses'
101
+ * Method: POST
102
+ *
103
+ * @param {string} termsOfServicesID - Terms of services ID to retrieve user statuses on
104
+ * @param {boolean} isAccepted - Determines wehether the terms of services has been accepted or rejected
105
+ * @param {Object} [options] - Additional options. Can be left null in most cases.
106
+ * @param {string} [options.user_id] - Optional, user id to retrieve terms of service status on, default is current user
107
+ * @param {Function} [callback] - Passed the terms of service user status information if successful, error otherwise
108
+ * @returns {Promise<Object>} A promise resolving to the terms of service user status
109
+ */
110
+ createUserStatus(termsOfServicesID: string, isAccepted: boolean, options?: {
111
+ user_id?: string;
112
+ }, callback?: Function): any;
113
+ /**
114
+ * Gets a terms os service status given the terms of services id
115
+ *
116
+ * API Endpoint: '/terms_of_service_user_statuses'
117
+ * Method: GET
118
+ *
119
+ * @param {string} termsOfServicesID - The ID of the terms of services to retrieve status on
120
+ * @param {Object} [options] - Additional options. Can be left null in most cases
121
+ * @param {string} [options.user_id] - Optional, the id of the user to retrieve status of custom terms and service on
122
+ * @param {Function} [callback] - Passed the terms of service user status information if successful, error otherwise
123
+ * @returns {Promise<Object>} A promise resolving to the terms of service user status
124
+ */
125
+ getUserStatus(termsOfServicesID: string, options?: {
126
+ user_id?: string;
127
+ }, callback?: Function): any;
128
+ /**
129
+ * Accepts/rejects custom terms of services for the user
130
+ *
131
+ * API Endpoint: '/terms_of_service_user_statuses'
132
+ * Method: PUT
133
+ *
134
+ * @param {string} termsOfServiceUserStatusID - Terms of service user status object ID
135
+ * @param {boolean} isAccepted - Determines wehether the terms of services has been accepted or rejected
136
+ * @param {Function} [callback] - Passed the terms of service user status updated information if successful, error otherwise
137
+ * @returns {Promise<Object>} A promise resolving to the updated terms of service user status
138
+ */
139
+ updateUserStatus(termsOfServiceUserStatusID: string, isAccepted: boolean, callback?: Function): any;
140
+ /**
141
+ * Creates a user status for terms of service, if already exists then update existing user status for terms of service
142
+ *
143
+ * API Endpoint: '/terms_of_service_user_statuses'
144
+ * Method: POST/PUT
145
+ *
146
+ * @param {string} termsOfServicesID - Terms of services ID to retrieve user statuses on
147
+ * @param {boolean} isAccepted - Determines wehether the terms of services has been accepted or rejected
148
+ * @param {Object} [options] - Additional options. Can be left null in most cases.
149
+ * @param {string} [options.user_id] - Optional, user id to retrieve terms of service status on, default is current user
150
+ * @param {Function} [callback] - Passed the terms of service user status information if successful, error otherwise
151
+ * @returns {Promise<Object>} A promise resolving to the terms of service user status
152
+ */
153
+ setUserStatus(termsOfServicesID: string, isAccepted: boolean, options?: {
154
+ user_id?: string;
155
+ }, callback?: Function): any;
156
+ }
157
+ /**
158
+ * @module box-node-sdk/lib/managers/terms-of-service
159
+ * @see {@Link TermsOfService}
160
+ */
161
+ export = TermsOfService;