box-node-sdk 1.35.0 → 1.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -2
- package/README.md +1 -1
- package/lib/api-request-manager.d.ts +38 -0
- package/lib/api-request-manager.js +48 -55
- package/lib/api-request-manager.js.map +1 -0
- package/lib/api-request.d.ts +141 -0
- package/lib/api-request.js +202 -281
- package/lib/api-request.js.map +1 -0
- package/lib/box-client.d.ts +269 -0
- package/lib/box-client.js +551 -713
- package/lib/box-client.js.map +1 -0
- package/lib/box-node-sdk.d.ts +216 -0
- package/lib/box-node-sdk.js +317 -352
- package/lib/box-node-sdk.js.map +1 -0
- package/lib/chunked-uploader.d.ts +129 -0
- package/lib/chunked-uploader.js +287 -358
- package/lib/chunked-uploader.js.map +1 -0
- package/lib/enterprise-event-stream.d.ts +82 -0
- package/lib/enterprise-event-stream.js +189 -203
- package/lib/enterprise-event-stream.js.map +1 -0
- package/lib/event-stream.d.ts +92 -0
- package/lib/event-stream.js +274 -302
- package/lib/event-stream.js.map +1 -0
- package/lib/managers/collaboration-allowlist.d.ts +137 -0
- package/lib/managers/collaboration-allowlist.js +200 -0
- package/lib/managers/collaboration-allowlist.js.map +1 -0
- package/lib/managers/collaboration-whitelist.d.ts +3 -0
- package/lib/managers/collaboration-whitelist.js +8 -222
- package/lib/managers/collaboration-whitelist.js.map +1 -0
- package/lib/managers/collaborations.d.ts +166 -0
- package/lib/managers/collaborations.js +225 -258
- package/lib/managers/collaborations.js.map +1 -0
- package/lib/managers/collections.d.ts +42 -0
- package/lib/managers/collections.js +45 -50
- package/lib/managers/collections.js.map +1 -0
- package/lib/managers/comments.d.ts +103 -0
- package/lib/managers/comments.js +158 -173
- package/lib/managers/comments.js.map +1 -0
- package/lib/managers/device-pins.d.ts +52 -0
- package/lib/managers/device-pins.js +75 -88
- package/lib/managers/device-pins.js.map +1 -0
- package/lib/managers/enterprise.d.ts +162 -0
- package/lib/managers/enterprise.js +168 -199
- package/lib/managers/enterprise.js.map +1 -0
- package/lib/managers/events.d.ts +177 -0
- package/lib/managers/events.js +230 -254
- package/lib/managers/events.js.map +1 -0
- package/lib/managers/files.d.ts +772 -0
- package/lib/managers/files.js +1400 -1602
- package/lib/managers/files.js.map +1 -0
- package/lib/managers/folders.d.ts +347 -0
- package/lib/managers/folders.js +551 -567
- package/lib/managers/folders.js.map +1 -0
- package/lib/managers/groups.d.ts +202 -0
- package/lib/managers/groups.js +238 -287
- package/lib/managers/groups.js.map +1 -0
- package/lib/managers/legal-hold-policies.d.ts +190 -0
- package/lib/managers/legal-hold-policies.js +228 -272
- package/lib/managers/legal-hold-policies.js.map +1 -0
- package/lib/managers/metadata.d.ts +228 -0
- package/lib/managers/metadata.js +265 -328
- package/lib/managers/metadata.js.map +1 -0
- package/lib/managers/recent-items.d.ts +38 -0
- package/lib/managers/recent-items.js +32 -39
- package/lib/managers/recent-items.js.map +1 -0
- package/lib/managers/retention-policies.d.ts +213 -0
- package/lib/managers/retention-policies.js +235 -281
- package/lib/managers/retention-policies.js.map +1 -0
- package/lib/managers/search.d.ts +82 -0
- package/lib/managers/search.js +68 -88
- package/lib/managers/search.js.map +1 -0
- package/lib/managers/shared-items.d.ts +33 -0
- package/lib/managers/shared-items.js +54 -62
- package/lib/managers/shared-items.js.map +1 -0
- package/lib/managers/storage-policies.d.ts +86 -0
- package/lib/managers/storage-policies.js +108 -142
- package/lib/managers/storage-policies.js.map +1 -0
- package/lib/managers/tasks.d.ts +161 -0
- package/lib/managers/tasks.js +219 -260
- package/lib/managers/tasks.js.map +1 -0
- package/lib/managers/terms-of-service.d.ts +161 -0
- package/lib/managers/terms-of-service.js +250 -273
- package/lib/managers/terms-of-service.js.map +1 -0
- package/lib/managers/trash.d.ts +30 -0
- package/lib/managers/trash.js +30 -41
- package/lib/managers/trash.js.map +1 -0
- package/lib/managers/users.d.ts +131 -0
- package/lib/managers/users.js +160 -203
- package/lib/managers/users.js.map +1 -0
- package/lib/managers/web-links.d.ts +127 -0
- package/lib/managers/web-links.js +183 -209
- package/lib/managers/web-links.js.map +1 -0
- package/lib/managers/webhooks.d.ts +166 -0
- package/lib/managers/webhooks.js +312 -305
- package/lib/managers/webhooks.js.map +1 -0
- package/lib/sessions/anonymous-session.d.ts +69 -0
- package/lib/sessions/anonymous-session.js +88 -102
- package/lib/sessions/anonymous-session.js.map +1 -0
- package/lib/sessions/app-auth-session.d.ts +92 -0
- package/lib/sessions/app-auth-session.js +140 -160
- package/lib/sessions/app-auth-session.js.map +1 -0
- package/lib/sessions/basic-session.d.ts +56 -0
- package/lib/sessions/basic-session.js +40 -50
- package/lib/sessions/basic-session.js.map +1 -0
- package/lib/sessions/persistent-session.d.ts +96 -0
- package/lib/sessions/persistent-session.js +191 -211
- package/lib/sessions/persistent-session.js.map +1 -0
- package/lib/token-manager.d.ts +191 -0
- package/lib/token-manager.js +390 -465
- package/lib/token-manager.js.map +1 -0
- package/lib/util/config.d.ts +86 -0
- package/lib/util/config.js +124 -152
- package/lib/util/config.js.map +1 -0
- package/lib/util/errors.d.ts +50 -0
- package/lib/util/errors.js +134 -145
- package/lib/util/errors.js.map +1 -0
- package/lib/util/exponential-backoff.d.ts +11 -0
- package/lib/util/exponential-backoff.js +10 -22
- package/lib/util/exponential-backoff.js.map +1 -0
- package/lib/util/paging-iterator.d.ts +53 -0
- package/lib/util/paging-iterator.js +202 -218
- package/lib/util/paging-iterator.js.map +1 -0
- package/lib/util/url-path.d.ts +16 -0
- package/lib/util/url-path.js +20 -35
- package/lib/util/url-path.js.map +1 -0
- package/package.json +24 -9
|
@@ -1,23 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @fileoverview Manager for the Box Collection Resource
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
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"));
|
|
9
|
+
// -----------------------------------------------------------------------------
|
|
10
|
+
// Typedefs
|
|
11
|
+
// -----------------------------------------------------------------------------
|
|
12
12
|
// ------------------------------------------------------------------------------
|
|
13
13
|
// Private
|
|
14
14
|
// ------------------------------------------------------------------------------
|
|
15
15
|
var BASE_PATH = '/collections';
|
|
16
|
-
|
|
17
16
|
// ------------------------------------------------------------------------------
|
|
18
17
|
// Public
|
|
19
18
|
// ------------------------------------------------------------------------------
|
|
20
|
-
|
|
21
19
|
/**
|
|
22
20
|
* Simple manager for interacting with all 'Collection' endpoints and actions.
|
|
23
21
|
*
|
|
@@ -25,44 +23,41 @@ var BASE_PATH = '/collections';
|
|
|
25
23
|
* @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
|
|
26
24
|
* @returns {void}
|
|
27
25
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Collections.prototype.getAll = function(callback) {
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @module box-node-sdk/lib/managers/collections
|
|
66
|
-
* @see {@Link Collections}
|
|
67
|
-
*/
|
|
26
|
+
var Collections = /** @class */ (function () {
|
|
27
|
+
function Collections(client) {
|
|
28
|
+
this.client = client;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Requests all of a user's collection objects.
|
|
32
|
+
*
|
|
33
|
+
* API Endpoint: '/collections'
|
|
34
|
+
* Method: GET
|
|
35
|
+
*
|
|
36
|
+
* @param {Function} [callback] - Called with a collection of collections if successful
|
|
37
|
+
* @returns {Promise<Object>} A promise resolving to the collection of collections
|
|
38
|
+
*/
|
|
39
|
+
Collections.prototype.getAll = function (callback) {
|
|
40
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(BASE_PATH, {}, callback);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Requests the items in the collection object with a given ID.
|
|
44
|
+
*
|
|
45
|
+
* API Endpoint: '/collections/:collectionID/items'
|
|
46
|
+
* Method: GET
|
|
47
|
+
*
|
|
48
|
+
* @param {string} collectionID - Box ID of the collection with items being requested
|
|
49
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
50
|
+
* @param {Function} [callback] - Passed the items information if they were acquired successfully
|
|
51
|
+
* @returns {Promise<Object>} A promise resolving to the collection of items in the collection
|
|
52
|
+
*/
|
|
53
|
+
Collections.prototype.getItems = function (collectionID, options, callback) {
|
|
54
|
+
var params = {
|
|
55
|
+
qs: options,
|
|
56
|
+
};
|
|
57
|
+
var apiPath = url_path_1.default(BASE_PATH, collectionID, 'items');
|
|
58
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
59
|
+
};
|
|
60
|
+
return Collections;
|
|
61
|
+
}());
|
|
68
62
|
module.exports = Collections;
|
|
63
|
+
//# sourceMappingURL=collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/managers/collections.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAOH,8DAAuC;AAEvC,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,iFAAiF;AACjF,UAAU;AACV,iFAAiF;AAEjF,IAAM,SAAS,GAAG,cAAc,CAAC;AAEjC,iFAAiF;AACjF,SAAS;AACT,iFAAiF;AAEjF;;;;;;GAMG;AACH;IAGC,qBAAY,MAAiB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;;;;;;;OAQG;IACH,4BAAM,GAAN,UAAO,QAAmB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CACzD,SAAS,EACT,EAAE,EACF,QAAQ,CACR,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,8BAAQ,GAAR,UACC,YAAoB,EACpB,OAA6B,EAC7B,QAAmB;QAEnB,IAAI,MAAM,GAAG;YACZ,EAAE,EAAE,OAAO;SACX,CAAC;QACF,IAAI,OAAO,GAAG,kBAAO,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CACzD,OAAO,EACP,MAAM,EACN,QAAQ,CACR,CAAC;IACH,CAAC;IACF,kBAAC;AAAD,CAAC,AAlDD,IAkDC;AAMD,iBAAS,WAAW,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Manager for the Box Comments Resource
|
|
3
|
+
*/
|
|
4
|
+
import BoxClient from '../box-client';
|
|
5
|
+
/**
|
|
6
|
+
* Simple manager for interacting with all 'Comment' endpoints and actions.
|
|
7
|
+
*
|
|
8
|
+
* @constructor
|
|
9
|
+
* @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
declare class Comments {
|
|
13
|
+
client: BoxClient;
|
|
14
|
+
constructor(client: BoxClient);
|
|
15
|
+
/**
|
|
16
|
+
* Requests a comment object with the given ID.
|
|
17
|
+
*
|
|
18
|
+
* API Endpoint: '/comments/:commentID'
|
|
19
|
+
* Method: GET
|
|
20
|
+
*
|
|
21
|
+
* @param {string} commentID - Box ID of the comment being requested
|
|
22
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
23
|
+
* @param {Function} [callback] - Passed the comment information if it was acquired successfully
|
|
24
|
+
* @returns {Promise<Object>} A promise resolving to the comment object
|
|
25
|
+
*/
|
|
26
|
+
get(commentID: string, options?: Record<string, any>, callback?: Function): any;
|
|
27
|
+
/**
|
|
28
|
+
* Posts a new comment on a file.
|
|
29
|
+
*
|
|
30
|
+
* API Endpoint: '/comments
|
|
31
|
+
* Method: POST
|
|
32
|
+
*
|
|
33
|
+
* @param {string} fileID - Box file id of the file to comment on
|
|
34
|
+
* @param {string} commentBody - text of the comment
|
|
35
|
+
* @param {Function} [callback] - passed the new comment data if it was posted successfully
|
|
36
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
37
|
+
*/
|
|
38
|
+
create(fileID: string, commentBody: string, callback?: Function): any;
|
|
39
|
+
/**
|
|
40
|
+
* Posts a new tagged comment on a file.
|
|
41
|
+
*
|
|
42
|
+
* API Endpoint: '/comments
|
|
43
|
+
* Method: POST
|
|
44
|
+
*
|
|
45
|
+
* @param {string} fileID - Box file id of the file to comment on
|
|
46
|
+
* @param {string} commentBody - text of the tagged comment
|
|
47
|
+
* @param {Function} [callback] - passed the new tagged comment data if it was posted successfully
|
|
48
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
49
|
+
*/
|
|
50
|
+
createTaggedComment(fileID: string, commentBody: string, callback?: Function): any;
|
|
51
|
+
/**
|
|
52
|
+
* Posts a new comment as a reply to another comment.
|
|
53
|
+
*
|
|
54
|
+
* API Endpoint: '/comments
|
|
55
|
+
* Method: POST
|
|
56
|
+
*
|
|
57
|
+
* @param {string} commentID - Comment ID of the comment to reply to
|
|
58
|
+
* @param {string} commentBody - text of the comment
|
|
59
|
+
* @param {Function} [callback] - passed the new comment data if it was posted successfully
|
|
60
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
61
|
+
*/
|
|
62
|
+
reply(commentID: string, commentBody: string, callback?: Function): any;
|
|
63
|
+
/**
|
|
64
|
+
* Posts a new tagged comment as a reply to another comment.
|
|
65
|
+
*
|
|
66
|
+
* API Endpoint: '/comments
|
|
67
|
+
* Method: POST
|
|
68
|
+
*
|
|
69
|
+
* @param {string} commentID - Comment ID of the comment to reply to
|
|
70
|
+
* @param {string} commentBody - text of the tagged comment
|
|
71
|
+
* @param {Function} [callback] - passed the new tagged comment data if it was posted successfully
|
|
72
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
73
|
+
*/
|
|
74
|
+
createTaggedReply(commentID: string, commentBody: string, callback?: Function): any;
|
|
75
|
+
/**
|
|
76
|
+
* Update some information about a given comment.
|
|
77
|
+
*
|
|
78
|
+
* API Endpoint: '/comments/:commentID'
|
|
79
|
+
* Method: PUT
|
|
80
|
+
*
|
|
81
|
+
* @param {string} commentID - Box ID of the comment being requested
|
|
82
|
+
* @param {Object} updates - Fields to update on the comment
|
|
83
|
+
* @param {Function} [callback] - Passed the updated comment information if it was acquired successfully
|
|
84
|
+
* @returns {Promise<Object>} A promise resolving to the updated comment object
|
|
85
|
+
*/
|
|
86
|
+
update(commentID: string, updates: Record<string, any>, callback?: Function): any;
|
|
87
|
+
/**
|
|
88
|
+
* Delete a given comment.
|
|
89
|
+
*
|
|
90
|
+
* API Endpoint: '/comments/:commentID'
|
|
91
|
+
* Method: DELETE
|
|
92
|
+
*
|
|
93
|
+
* @param {string} commentID - Box ID of the comment being requested
|
|
94
|
+
* @param {Function} [callback] - Empty response body passed if successful.
|
|
95
|
+
* @returns {Promise<void>} A promise resolving to nothing
|
|
96
|
+
*/
|
|
97
|
+
delete(commentID: string, callback?: Function): any;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @module box-node-sdk/lib/managers/comments
|
|
101
|
+
* @see {@Link Comments}
|
|
102
|
+
*/
|
|
103
|
+
export = Comments;
|
package/lib/managers/comments.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @fileoverview Manager for the Box Comments Resource
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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"));
|
|
9
|
+
// -----------------------------------------------------------------------------
|
|
10
|
+
// Typedefs
|
|
11
|
+
// -----------------------------------------------------------------------------
|
|
13
12
|
// ------------------------------------------------------------------------------
|
|
14
13
|
// Private
|
|
15
14
|
// ------------------------------------------------------------------------------
|
|
16
15
|
var BASE_PATH = '/comments';
|
|
17
|
-
|
|
18
|
-
|
|
19
16
|
// ------------------------------------------------------------------------------
|
|
20
17
|
// Public
|
|
21
18
|
// ------------------------------------------------------------------------------
|
|
22
|
-
|
|
23
19
|
/**
|
|
24
20
|
* Simple manager for interacting with all 'Comment' endpoints and actions.
|
|
25
21
|
*
|
|
@@ -27,165 +23,154 @@ var BASE_PATH = '/comments';
|
|
|
27
23
|
* @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
|
|
28
24
|
* @returns {void}
|
|
29
25
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Comments.prototype.get = function(commentID, options, callback) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
*/
|
|
180
|
-
Comments.prototype.delete = function(commentID, callback) {
|
|
181
|
-
|
|
182
|
-
var apiPath = urlPath(BASE_PATH, commentID);
|
|
183
|
-
return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* @module box-node-sdk/lib/managers/comments
|
|
189
|
-
* @see {@Link Comments}
|
|
190
|
-
*/
|
|
26
|
+
var Comments = /** @class */ (function () {
|
|
27
|
+
function Comments(client) {
|
|
28
|
+
this.client = client;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Requests a comment object with the given ID.
|
|
32
|
+
*
|
|
33
|
+
* API Endpoint: '/comments/:commentID'
|
|
34
|
+
* Method: GET
|
|
35
|
+
*
|
|
36
|
+
* @param {string} commentID - Box ID of the comment being requested
|
|
37
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
38
|
+
* @param {Function} [callback] - Passed the comment information if it was acquired successfully
|
|
39
|
+
* @returns {Promise<Object>} A promise resolving to the comment object
|
|
40
|
+
*/
|
|
41
|
+
Comments.prototype.get = function (commentID, options, callback) {
|
|
42
|
+
var params = {
|
|
43
|
+
qs: options,
|
|
44
|
+
};
|
|
45
|
+
var apiPath = url_path_1.default(BASE_PATH, commentID);
|
|
46
|
+
return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Posts a new comment on a file.
|
|
50
|
+
*
|
|
51
|
+
* API Endpoint: '/comments
|
|
52
|
+
* Method: POST
|
|
53
|
+
*
|
|
54
|
+
* @param {string} fileID - Box file id of the file to comment on
|
|
55
|
+
* @param {string} commentBody - text of the comment
|
|
56
|
+
* @param {Function} [callback] - passed the new comment data if it was posted successfully
|
|
57
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
58
|
+
*/
|
|
59
|
+
Comments.prototype.create = function (fileID, commentBody, callback) {
|
|
60
|
+
// @TODO(bemerick) 2013-10-29: Don't hardcode this 'item'. Abstract to all commentable types...
|
|
61
|
+
var params = {
|
|
62
|
+
body: {
|
|
63
|
+
item: {
|
|
64
|
+
type: 'file',
|
|
65
|
+
id: fileID,
|
|
66
|
+
},
|
|
67
|
+
message: commentBody,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
return this.client.wrapWithDefaultHandler(this.client.post)(BASE_PATH, params, callback);
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Posts a new tagged comment on a file.
|
|
74
|
+
*
|
|
75
|
+
* API Endpoint: '/comments
|
|
76
|
+
* Method: POST
|
|
77
|
+
*
|
|
78
|
+
* @param {string} fileID - Box file id of the file to comment on
|
|
79
|
+
* @param {string} commentBody - text of the tagged comment
|
|
80
|
+
* @param {Function} [callback] - passed the new tagged comment data if it was posted successfully
|
|
81
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
82
|
+
*/
|
|
83
|
+
Comments.prototype.createTaggedComment = function (fileID, commentBody, callback) {
|
|
84
|
+
var params = {
|
|
85
|
+
body: {
|
|
86
|
+
item: {
|
|
87
|
+
type: 'file',
|
|
88
|
+
id: fileID,
|
|
89
|
+
},
|
|
90
|
+
tagged_message: commentBody,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
return this.client.wrapWithDefaultHandler(this.client.post)(BASE_PATH, params, callback);
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Posts a new comment as a reply to another comment.
|
|
97
|
+
*
|
|
98
|
+
* API Endpoint: '/comments
|
|
99
|
+
* Method: POST
|
|
100
|
+
*
|
|
101
|
+
* @param {string} commentID - Comment ID of the comment to reply to
|
|
102
|
+
* @param {string} commentBody - text of the comment
|
|
103
|
+
* @param {Function} [callback] - passed the new comment data if it was posted successfully
|
|
104
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
105
|
+
*/
|
|
106
|
+
Comments.prototype.reply = function (commentID, commentBody, callback) {
|
|
107
|
+
var params = {
|
|
108
|
+
body: {
|
|
109
|
+
item: {
|
|
110
|
+
type: 'comment',
|
|
111
|
+
id: commentID,
|
|
112
|
+
},
|
|
113
|
+
message: commentBody,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
return this.client.wrapWithDefaultHandler(this.client.post)(BASE_PATH, params, callback);
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Posts a new tagged comment as a reply to another comment.
|
|
120
|
+
*
|
|
121
|
+
* API Endpoint: '/comments
|
|
122
|
+
* Method: POST
|
|
123
|
+
*
|
|
124
|
+
* @param {string} commentID - Comment ID of the comment to reply to
|
|
125
|
+
* @param {string} commentBody - text of the tagged comment
|
|
126
|
+
* @param {Function} [callback] - passed the new tagged comment data if it was posted successfully
|
|
127
|
+
* @returns {Promise<Object>} A promise resolving to the new comment object
|
|
128
|
+
*/
|
|
129
|
+
Comments.prototype.createTaggedReply = function (commentID, commentBody, callback) {
|
|
130
|
+
var params = {
|
|
131
|
+
body: {
|
|
132
|
+
item: {
|
|
133
|
+
type: 'comment',
|
|
134
|
+
id: commentID,
|
|
135
|
+
},
|
|
136
|
+
tagged_message: commentBody,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
return this.client.wrapWithDefaultHandler(this.client.post)(BASE_PATH, params, callback);
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Update some information about a given comment.
|
|
143
|
+
*
|
|
144
|
+
* API Endpoint: '/comments/:commentID'
|
|
145
|
+
* Method: PUT
|
|
146
|
+
*
|
|
147
|
+
* @param {string} commentID - Box ID of the comment being requested
|
|
148
|
+
* @param {Object} updates - Fields to update on the comment
|
|
149
|
+
* @param {Function} [callback] - Passed the updated comment information if it was acquired successfully
|
|
150
|
+
* @returns {Promise<Object>} A promise resolving to the updated comment object
|
|
151
|
+
*/
|
|
152
|
+
Comments.prototype.update = function (commentID, updates, callback) {
|
|
153
|
+
var params = {
|
|
154
|
+
body: updates,
|
|
155
|
+
};
|
|
156
|
+
var apiPath = url_path_1.default(BASE_PATH, commentID);
|
|
157
|
+
return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback);
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Delete a given comment.
|
|
161
|
+
*
|
|
162
|
+
* API Endpoint: '/comments/:commentID'
|
|
163
|
+
* Method: DELETE
|
|
164
|
+
*
|
|
165
|
+
* @param {string} commentID - Box ID of the comment being requested
|
|
166
|
+
* @param {Function} [callback] - Empty response body passed if successful.
|
|
167
|
+
* @returns {Promise<void>} A promise resolving to nothing
|
|
168
|
+
*/
|
|
169
|
+
Comments.prototype.delete = function (commentID, callback) {
|
|
170
|
+
var apiPath = url_path_1.default(BASE_PATH, commentID);
|
|
171
|
+
return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, null, callback);
|
|
172
|
+
};
|
|
173
|
+
return Comments;
|
|
174
|
+
}());
|
|
191
175
|
module.exports = Comments;
|
|
176
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/managers/comments.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAOH,8DAAuC;AAEvC,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,iFAAiF;AACjF,UAAU;AACV,iFAAiF;AAEjF,IAAM,SAAS,GAAG,WAAW,CAAC;AAE9B,iFAAiF;AACjF,SAAS;AAC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,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CACzD,OAAO,EACP,IAAI,EACJ,QAAQ,CACR,CAAC;IACH,CAAC;IACF,eAAC;AAAD,CAAC,AAjMD,IAiMC;AAMD,iBAAS,QAAQ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Manager for the Device Pins resource
|
|
3
|
+
* @author mwiller
|
|
4
|
+
*/
|
|
5
|
+
import BoxClient from '../box-client';
|
|
6
|
+
/**
|
|
7
|
+
* Simple manager for interacting with all Device Pin endpoints and actions.
|
|
8
|
+
*
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
|
|
11
|
+
* @returns {void}
|
|
12
|
+
*/
|
|
13
|
+
declare class DevicePins {
|
|
14
|
+
client: BoxClient;
|
|
15
|
+
constructor(client: BoxClient);
|
|
16
|
+
/**
|
|
17
|
+
* Get a specific device pinning record
|
|
18
|
+
*
|
|
19
|
+
* API Endpoint: '/device_pinners/:pinID'
|
|
20
|
+
* Method: GET
|
|
21
|
+
*
|
|
22
|
+
* @param {string} pinID - The ID of the pin to retrieve
|
|
23
|
+
* @param {Object} [options] - Optional paramters, can be left null in many cases
|
|
24
|
+
* @param {Function} [callback] - Passed the device pin if successful, error otherwise
|
|
25
|
+
* @returns {Promise<Object>} A promise resolving to the device pin object
|
|
26
|
+
*/
|
|
27
|
+
get(pinID: string, options?: Record<string, any>, callback?: Function): any;
|
|
28
|
+
/**
|
|
29
|
+
* Delete a specific device pinning record
|
|
30
|
+
*
|
|
31
|
+
* API Endpoint: '/device_pinners/:pinID'
|
|
32
|
+
* Method: DELETE
|
|
33
|
+
*
|
|
34
|
+
* @param {string} pinID - The ID of the pin to delete
|
|
35
|
+
* @param {Object} [options] - Optional paramters, can be left null in many cases
|
|
36
|
+
* @param {Function} [callback] - Passed nothing if successful, error otherwise
|
|
37
|
+
* @returns {Promise<void>} A promise resolving to nothing
|
|
38
|
+
*/
|
|
39
|
+
delete(pinID: string, options?: Record<string, any>, callback?: Function): any;
|
|
40
|
+
/**
|
|
41
|
+
* Get all device pin records for the current enterprise
|
|
42
|
+
*
|
|
43
|
+
* API Endpoint: '/enterprises/:enterpriseID/device_pinners'
|
|
44
|
+
* Method: GET
|
|
45
|
+
*
|
|
46
|
+
* @param {Object} [options] - Optional paramters, can be left null in many cases
|
|
47
|
+
* @param {Function} [callback] - Passed a list of device pins if successful, error otherwise
|
|
48
|
+
* @returns {Promise<Object>} A promise resolving to the collection of device pins
|
|
49
|
+
*/
|
|
50
|
+
getAll(options?: Record<string, any>, callback?: Function): any;
|
|
51
|
+
}
|
|
52
|
+
export = DevicePins;
|