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,26 +1,23 @@
1
+ "use strict";
1
2
  /**
2
3
  * @fileoverview Manager for the Storage 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
+ };
7
8
  // -----------------------------------------------------------------------------
8
9
  // Requirements
9
10
  // -----------------------------------------------------------------------------
10
- var urlPath = require('../util/url-path'),
11
- httpStatus = require('http-status'),
12
- errors = require('../util/errors');
13
-
11
+ var http_status_1 = __importDefault(require("http-status"));
12
+ var errors_1 = __importDefault(require("../util/errors"));
13
+ var url_path_1 = __importDefault(require("../util/url-path"));
14
14
  // -----------------------------------------------------------------------------
15
15
  // Private
16
16
  // -----------------------------------------------------------------------------
17
- var BASE_PATH = '/storage_policies',
18
- ASSIGNMENTS_PATH = '/storage_policy_assignments';
19
-
17
+ var BASE_PATH = '/storage_policies', ASSIGNMENTS_PATH = '/storage_policy_assignments';
20
18
  // -----------------------------------------------------------------------------
21
19
  // Public
22
20
  // -----------------------------------------------------------------------------
23
-
24
21
  /**
25
22
  * Simple manager for interacting with all Retention Policies endpoints and actions.
26
23
  *
@@ -28,13 +25,11 @@ var BASE_PATH = '/storage_policies',
28
25
  * @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
29
26
  * @returns {void}
30
27
  */
31
- function StoragePolicies(client) {
32
- this.client = client;
33
- }
34
-
35
- StoragePolicies.prototype = {
36
-
37
- /**
28
+ var StoragePolicies = /** @class */ (function () {
29
+ function StoragePolicies(client) {
30
+ this.client = client;
31
+ }
32
+ /**
38
33
  * Get information about a specific storage policy
39
34
  * @param {string} storagePolicyID The ID of the storage policy
40
35
  * @param {Object} [options] Optional parameters
@@ -42,81 +37,67 @@ StoragePolicies.prototype = {
42
37
  * @param {Function} [callback] Passed the storage policy object if successful
43
38
  * @returns {Promise<Object>} Promise resolving to the storage policy object
44
39
  */
45
- get(storagePolicyID, options, callback) {
46
-
47
- var apiPath = urlPath(BASE_PATH, storagePolicyID),
48
- params = {
49
- qs: options
50
- };
51
-
52
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
53
- },
54
-
55
- /**
40
+ StoragePolicies.prototype.get = function (storagePolicyID, options, callback) {
41
+ var apiPath = url_path_1.default(BASE_PATH, storagePolicyID), params = {
42
+ qs: options,
43
+ };
44
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
45
+ };
46
+ /**
56
47
  * Get all available storage policies for the enterprise
57
48
  * @param {Object} [options] Optional parameters
58
49
  * @param {string} [options.fields] Comma-separated list of fields of the storage policy to retrieve
59
50
  * @param {Function} [callback] Passed a collection of storage policies if successful
60
51
  * @returns {Promise<Object>} Promise resolving to the collection of storage policies
61
52
  */
62
- getAll(options, callback) {
63
-
64
- var apiPath = urlPath(BASE_PATH),
65
- params = {
66
- qs: options
67
- };
68
-
69
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
70
- },
71
-
72
- /**
53
+ StoragePolicies.prototype.getAll = function (options, callback) {
54
+ var apiPath = url_path_1.default(BASE_PATH), params = {
55
+ qs: options,
56
+ };
57
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
58
+ };
59
+ /**
73
60
  * Assign a storage policy to a user
74
61
  * @param {string} storagePolicyID The ID of the storage policy to assign
75
62
  * @param {string} userID The ID of the user to assign the storage policy to
76
63
  * @param {Function} [callback] Passed the assignment object if successful
77
64
  * @returns {Promise<Object>} Promise resolving to the assignment object
78
65
  */
79
- assign(storagePolicyID, userID, callback) {
80
-
81
- return this.getAssignmentForTarget(userID)
82
- .then(assignment => {
83
- // Check if the assignment is already correct
84
- if (assignment.storage_policy.id === storagePolicyID) {
85
- return assignment;
86
- }
87
-
88
- // If the assignment is to an enterprise, we need to create a new
89
- // assignment for the user
90
- if (assignment.assigned_to.type === 'enterprise') {
91
- return this.createAssignment(storagePolicyID, userID);
92
- }
93
-
94
- // Update the user's existing assignment
95
- var update = {
96
- storage_policy: {
97
- type: 'storage_policy',
98
- id: storagePolicyID
99
- }
100
- };
101
- return this.updateAssignment(assignment.id, update);
102
- })
103
- .asCallback(callback);
104
- },
105
-
106
- /**
66
+ StoragePolicies.prototype.assign = function (storagePolicyID, userID, callback) {
67
+ var _this = this;
68
+ return this.getAssignmentForTarget(userID)
69
+ .then(function (assignment /* FIXME */) {
70
+ // Check if the assignment is already correct
71
+ if (assignment.storage_policy.id === storagePolicyID) {
72
+ return assignment;
73
+ }
74
+ // If the assignment is to an enterprise, we need to create a new
75
+ // assignment for the user
76
+ if (assignment.assigned_to.type === 'enterprise') {
77
+ return _this.createAssignment(storagePolicyID, userID);
78
+ }
79
+ // Update the user's existing assignment
80
+ var update = {
81
+ storage_policy: {
82
+ type: 'storage_policy',
83
+ id: storagePolicyID,
84
+ },
85
+ };
86
+ return _this.updateAssignment(assignment.id, update);
87
+ })
88
+ .asCallback(callback);
89
+ };
90
+ /**
107
91
  * Get information about a specific storage policy asisgnment by ID
108
92
  * @param {string} assignmentID The ID of the assignment
109
93
  * @param {Function} [callback] Passed the assignment object if successful
110
94
  * @returns {Promise<Object>} Promise resolving to the assignment object
111
95
  */
112
- getAssignment(assignmentID, callback) {
113
-
114
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID);
115
-
116
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, null, callback);
117
- },
118
-
119
- /**
96
+ StoragePolicies.prototype.getAssignment = function (assignmentID, callback) {
97
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID);
98
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, null, callback);
99
+ };
100
+ /**
120
101
  * Gets the storage policy assignment for a specific user
121
102
  * @param {string} targetID The ID of the target
122
103
  * @param {Object} [options] Optional parameters
@@ -124,87 +105,72 @@ StoragePolicies.prototype = {
124
105
  * @param {Function} [callback] Passed the assignment object if successful
125
106
  * @returns {Promise<Object>} Promise resolving to the assignment object
126
107
  */
127
- getAssignmentForTarget(targetID, options, callback) {
128
-
129
- options = Object.assign({ targetType: 'user' }, options);
130
-
131
- var apiPath = urlPath(ASSIGNMENTS_PATH),
132
- params = {
133
- qs: {
134
- resolved_for_type: options.targetType,
135
- resolved_for_id: targetID
136
- }
137
- };
138
-
139
- return this.client.get(apiPath, params)
140
- .then(response => {
141
-
142
- if (response.statusCode !== httpStatus.OK) {
143
- // Unexpected status code, throw an error
144
- throw errors.buildUnexpectedResponseError(response);
145
- }
146
-
147
- // Unwrap the collection and give back just the assignment object
148
- return response.body.entries[0];
149
- })
150
- .asCallback(callback);
151
- },
152
-
153
- /**
108
+ StoragePolicies.prototype.getAssignmentForTarget = function (targetID, options, callback) {
109
+ options = Object.assign({ targetType: 'user' }, options);
110
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH), params = {
111
+ qs: {
112
+ resolved_for_type: options.targetType,
113
+ resolved_for_id: targetID,
114
+ },
115
+ };
116
+ return this.client
117
+ .get(apiPath, params)
118
+ .then(function (response /* FIXME */) {
119
+ if (response.statusCode !== http_status_1.default.OK) {
120
+ // Unexpected status code, throw an error
121
+ throw errors_1.default.buildUnexpectedResponseError(response);
122
+ }
123
+ // Unwrap the collection and give back just the assignment object
124
+ return response.body.entries[0];
125
+ })
126
+ .asCallback(callback);
127
+ };
128
+ /**
154
129
  * Create a new storage policy assignment to a user
155
130
  * @param {string} storagePolicyID The ID of the storage policy to assign
156
131
  * @param {string} userID The ID of the user to assign the storage policy to
157
132
  * @param {Function} [callback] Passed the assignment object if successful
158
133
  * @returns {Promise<Object>} Promise resolving to the assignment object
159
134
  */
160
- createAssignment(storagePolicyID, userID, callback) {
161
-
162
- var apiPath = urlPath(ASSIGNMENTS_PATH),
163
- params = {
164
- body: {
165
- storage_policy: {
166
- type: 'storage_policy',
167
- id: storagePolicyID
168
- },
169
- assigned_to: {
170
- type: 'user',
171
- id: userID
172
- }
173
- }
174
- };
175
-
176
- return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
177
- },
178
-
179
- /**
135
+ StoragePolicies.prototype.createAssignment = function (storagePolicyID, userID, callback) {
136
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH), params = {
137
+ body: {
138
+ storage_policy: {
139
+ type: 'storage_policy',
140
+ id: storagePolicyID,
141
+ },
142
+ assigned_to: {
143
+ type: 'user',
144
+ id: userID,
145
+ },
146
+ },
147
+ };
148
+ return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback);
149
+ };
150
+ /**
180
151
  * Update a storage policy assignment
181
152
  * @param {string} assignmentID The ID of the storage policy assignment to update
182
153
  * @param {Object} updates The updates fields to apply
183
154
  * @param {Function} [callback] Passed the updated assignment object if successful
184
155
  * @returns {Promise<Object>} Promise resolving to the updated assignment object
185
156
  */
186
- updateAssignment(assignmentID, updates, callback) {
187
-
188
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID),
189
- params = {
190
- body: updates
191
- };
192
-
193
- return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
194
- },
195
-
196
- /**
157
+ StoragePolicies.prototype.updateAssignment = function (assignmentID, updates, callback) {
158
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID), params = {
159
+ body: updates,
160
+ };
161
+ return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
162
+ };
163
+ /**
197
164
  * Remove a storage policy assignment, returning the user to the default policy
198
165
  * @param {string} assignmentID The ID of the assignment to remove
199
166
  * @param {Function} [callback] Passed nothing if successful
200
167
  * @returns {Promise<void>} Promise resolving if the removal succeeds
201
168
  */
202
- removeAssignment(assignmentID, callback) {
203
-
204
- var apiPath = urlPath(ASSIGNMENTS_PATH, assignmentID);
205
-
206
- return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
207
- }
208
- };
209
-
169
+ StoragePolicies.prototype.removeAssignment = function (assignmentID, callback) {
170
+ var apiPath = url_path_1.default(ASSIGNMENTS_PATH, assignmentID);
171
+ return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
172
+ };
173
+ return StoragePolicies;
174
+ }());
210
175
  module.exports = StoragePolicies;
176
+ //# sourceMappingURL=storage-policies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-policies.js","sourceRoot":"","sources":["../../src/managers/storage-policies.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF,4DAAqC;AAErC,0DAAoC;AACpC,8DAAuC;AAEvC,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,IAAM,SAAS,GAAG,mBAAmB,EACpC,gBAAgB,GAAG,6BAA6B,CAAC;AAElD,gFAAgF;AAChF,SAAS;AACT,gFAAgF;AAEhF;;;;;;GAMG;AACH;IAGC,yBAAY,MAAiB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;;;;;;OAOG;IACH,6BAAG,GAAH,UACC,eAAuB,EACvB,OAEC,EACD,QAAmB;QAEnB,IAAI,OAAO,GAAG,kBAAO,CAAC,SAAS,EAAE,eAAe,CAAC,EAChD,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;IAED;;;;;;OAMG;IACH,gCAAM,GAAN,UACC,OAEC,EACD,QAAmB;QAEnB,IAAI,OAAO,GAAG,kBAAO,CAAC,SAAS,CAAC,EAC/B,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;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,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CACzD,OAAO,EACP,MAAM,EACN,QAAQ,CACR,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,0CAAgB,GAAhB,UAAiB,YAAoB,EAAE,QAAmB;QACzD,IAAI,OAAO,GAAG,kBAAO,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAEtD,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CACzD,OAAO,EACP,IAAI,EACJ,QAAQ,CACR,CAAC;IACH,CAAC;IACF,sBAAC;AAAD,CAAC,AA3ND,IA2NC;AAED,iBAAS,eAAe,CAAC"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @fileoverview Manager for the Tasks Resource
3
+ */
4
+ import BoxClient from '../box-client';
5
+ /**
6
+ * Enum of valid task resolution states
7
+ * @readonly
8
+ * @enum {TaskResolutionState}
9
+ */
10
+ declare enum TaskResolutionState {
11
+ COMPLETE = "completed",
12
+ INCOMPLETE = "incomplete",
13
+ APPROVED = "approved",
14
+ REJECTED = "rejected"
15
+ }
16
+ /**
17
+ * Simple manager for interacting with all 'Tasks' endpoints and actions.
18
+ *
19
+ * @constructor
20
+ * @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
21
+ * @returns {void}
22
+ */
23
+ declare class Tasks {
24
+ client: BoxClient;
25
+ resolutionStates: typeof TaskResolutionState;
26
+ constructor(client: BoxClient);
27
+ /**
28
+ * Used to create a single task for single user on a single file.
29
+ *
30
+ * API Endpoint: '/tasks'
31
+ * Method: POST
32
+ *
33
+ * @param {string} fileID - The ID of the item this task is for
34
+ * @param {Object} [options] - Additional parameters
35
+ * @param {string} [options.message] - An optional message to include with the task
36
+ * @param {string} [options.due_at] - The day at which this task is due
37
+ * @param {Function} [callback] - Passed the new task information if it was acquired successfully, error otherwise
38
+ * @returns {Promise<Object>} A promise resolving to the created task object
39
+ */
40
+ create(fileID: string, options?: {
41
+ message?: string;
42
+ due_at?: string;
43
+ }, callback?: Function): any;
44
+ /**
45
+ * Fetches a specific task.
46
+ *
47
+ * API Endpoint: '/tasks/:taskID'
48
+ * Method: GET
49
+ *
50
+ * @param {string} taskID - The Box ID of the task being requested
51
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
52
+ * @param {Function} [callback] - Passed the task information if it was acquired successfully, error otherwise
53
+ * @returns {Promise<Object>} A promise resolving to the task object
54
+ */
55
+ get(taskID: string, options?: Record<string, any>, callback?: Function): any;
56
+ /**
57
+ * Updates a specific task.
58
+ *
59
+ * API Endpoint: '/tasks/:taskID'
60
+ * Method: PUT
61
+ *
62
+ * @param {string} taskID - The Box ID of the task being updated
63
+ * @param {Object} updates - Fields of the task object to update
64
+ * @param {string} [updates.message] - An optional message to include with the task
65
+ * @param {string} [updates.due_at] - The day at which this task is due
66
+ * @param {Function} [callback] - Passed the updated task information if it was acquired successfully, error otherwise
67
+ * @returns {Promise<Object>} A promise resolving to the updated task object
68
+ */
69
+ update(taskID: string, updates?: {
70
+ message?: string;
71
+ due_at?: string;
72
+ }, callback?: Function): any;
73
+ /**
74
+ * Permanently deletes a specific task.
75
+ *
76
+ * API Endpoint: '/tasks/:taskID'
77
+ * Method: DELETE
78
+ *
79
+ * @param {string} taskID - The Box ID of the task being deleted
80
+ * @param {Function} [callback] - Empty body passed if successful, error otherwise
81
+ * @returns {Promise<void>} A promise resolving to nothing
82
+ */
83
+ delete(taskID: string, callback?: Function): any;
84
+ /**
85
+ * Get a list of assignments for a given task
86
+ *
87
+ * API Endpoint: '/tasks/:taskID/assignments'
88
+ * Method: GET
89
+ *
90
+ * @param {string} taskID - The Box ID of the task to get assignments for
91
+ * @param {Object} [options] - Additional parameters, can be left null in most cases
92
+ * @param {Function} [callback] - Passed the list of assignments if successful, error otherwise
93
+ * @returns {Promise<Object>} A promise resolving to the collection of assignment objects
94
+ */
95
+ getAssignments(taskID: string, options?: Record<string, any>, callback?: Function): any;
96
+ /**
97
+ * Get a specific task assignment
98
+ *
99
+ * API Endpoint: '/task_assignments/:assignmentID'
100
+ * Method: GET
101
+ *
102
+ * @param {string} assignmentID - The Box ID of the task assignment to retrieve
103
+ * @param {Object} [options] - Additional parameters, can be left null in most cases
104
+ * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
105
+ * @returns {Promise<Object>} A promise resolving to the assignment object
106
+ */
107
+ getAssignment(assignmentID: string, options?: Record<string, any>, callback?: Function): any;
108
+ /**
109
+ * Assign a task to a specific user by ID
110
+ *
111
+ * API Endpoint: '/task_assignments'
112
+ * Method: POST
113
+ *
114
+ * @param {string} taskID - The Box ID of the task to assign
115
+ * @param {string} userID - The ID of the user to assign the task to
116
+ * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
117
+ * @returns {Promise<Object>} A promise resolving to the new assignment object
118
+ */
119
+ assignByUserID(taskID: string, userID: string, callback?: Function): any;
120
+ /**
121
+ * Assign a task to a specific user by email address
122
+ *
123
+ * API Endpoint: '/task_assignments'
124
+ * Method: POST
125
+ *
126
+ * @param {string} taskID - The Box ID of the task to assign
127
+ * @param {string} email - The email address of the user to assign the task to
128
+ * @param {Function} [callback] - Passed the task assignment if successful, error otherwise
129
+ * @returns {Promise<Object>} A promise resolving to the new assignment object
130
+ */
131
+ assignByEmail(taskID: string, email: string, callback?: Function): any;
132
+ /**
133
+ * Update a task assignment. This is used to resolve or complete a task.
134
+ *
135
+ * API Endpoint: '/task_assignments/:assignmentID'
136
+ * Method: PUT
137
+ *
138
+ * @param {string} assignmentID - The Box ID of the task assignment to update
139
+ * @param {Object} options - The fields of the assignment to update
140
+ * @param {string} [options.message] - A message from the assignee about this task
141
+ * @param {TaskResolutionState} [options.resolution_state] - Resolution of the task
142
+ * @param {Function} [callback] - Passed the updated task assignment if successful, error otherwise
143
+ * @returns {Promise<Object>} A promise resolving to the updated assignment object
144
+ */
145
+ updateAssignment(assignmentID: string, options?: {
146
+ message?: string;
147
+ resolution_state?: TaskResolutionState;
148
+ }, callback?: Function): any;
149
+ /**
150
+ * Delete a task assignment. This unassigns a user from the related task.
151
+ *
152
+ * API Endpoint: '/task_assignments/:assignmentID'
153
+ * Method: DELETE
154
+ *
155
+ * @param {string} assignmentID - The Box ID of the task assignment to delete
156
+ * @param {Function} [callback] - Passed nothing if successful, error otherwise
157
+ * @returns {Promise<void>} A promise resolving to nothing
158
+ */
159
+ deleteAssignment(assignmentID: string, callback?: Function): any;
160
+ }
161
+ export = Tasks;