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
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @fileoverview Manager for the Box RecentItem Resource
3
+ */
4
+ import BoxClient from '../box-client';
5
+ /**
6
+ * Simple manager for interacting with all 'RecentItem' 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 RecentItems {
13
+ client: BoxClient;
14
+ constructor(client: BoxClient);
15
+ /**
16
+ * Requests all items that have been accessed by a user in the last 90 days or the last 1000 items accessed.
17
+ *
18
+ * API Endpoint: '/recent_items'
19
+ * Method: GET
20
+ *
21
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
22
+ * @param {int} [options.limit] Maximum number of items to return
23
+ * @param {string} [options.marker] The position marker for marker-based paging
24
+ * @param {string} [options.fields] Comma-separated list of fields to include in the response
25
+ * @param {Function} [callback] - Passed the items information if they were acquired successfully
26
+ * @returns {Promise<Object>} A promise resolving to the collection of items in the collection
27
+ */
28
+ get(options?: {
29
+ limit?: number;
30
+ marker?: string;
31
+ fields?: string;
32
+ }, callback?: Function): any;
33
+ }
34
+ /**
35
+ * @module box-node-sdk/lib/managers/recent-items
36
+ * @see {@Link RecentItems}
37
+ */
38
+ export = RecentItems;
@@ -1,23 +1,18 @@
1
+ "use strict";
1
2
  /**
2
3
  * @fileoverview Manager for the Box RecentItem Resource
3
4
  */
4
-
5
- 'use strict';
6
-
7
- // ------------------------------------------------------------------------------
8
- // Requirements
9
- // ------------------------------------------------------------------------------
10
- var urlPath = require('../util/url-path');
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"));
12
9
  // ------------------------------------------------------------------------------
13
10
  // Private
14
11
  // ------------------------------------------------------------------------------
15
12
  var BASE_PATH = '/recent_items';
16
-
17
13
  // ------------------------------------------------------------------------------
18
14
  // Public
19
15
  // ------------------------------------------------------------------------------
20
-
21
16
  /**
22
17
  * Simple manager for interacting with all 'RecentItem' endpoints and actions.
23
18
  *
@@ -25,33 +20,31 @@ var BASE_PATH = '/recent_items';
25
20
  * @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
26
21
  * @returns {void}
27
22
  */
28
- function RecentItems(client) {
29
- this.client = client;
30
- }
31
-
32
- /**
33
- * Requests all items that have been accessed by a user in the last 90 days or the last 1000 items accessed.
34
- *
35
- * API Endpoint: '/recent_items'
36
- * Method: GET
37
- *
38
- * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
39
- * @param {int} [options.limit] Maximum number of items to return
40
- * @param {string} [options.marker] The position marker for marker-based paging
41
- * @param {string} [options.fields] Comma-separated list of fields to include in the response
42
- * @param {Function} [callback] - Passed the items information if they were acquired successfully
43
- * @returns {Promise<Object>} A promise resolving to the collection of items in the collection
44
- */
45
- RecentItems.prototype.get = function(options, callback) {
46
- var params = {
47
- qs: options
48
- };
49
- var apiPath = urlPath(BASE_PATH);
50
- return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
51
- };
52
-
53
- /**
54
- * @module box-node-sdk/lib/managers/recent-items
55
- * @see {@Link RecentItems}
56
- */
23
+ var RecentItems = /** @class */ (function () {
24
+ function RecentItems(client) {
25
+ this.client = client;
26
+ }
27
+ /**
28
+ * Requests all items that have been accessed by a user in the last 90 days or the last 1000 items accessed.
29
+ *
30
+ * API Endpoint: '/recent_items'
31
+ * Method: GET
32
+ *
33
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
34
+ * @param {int} [options.limit] Maximum number of items to return
35
+ * @param {string} [options.marker] The position marker for marker-based paging
36
+ * @param {string} [options.fields] Comma-separated list of fields to include in the response
37
+ * @param {Function} [callback] - Passed the items information if they were acquired successfully
38
+ * @returns {Promise<Object>} A promise resolving to the collection of items in the collection
39
+ */
40
+ RecentItems.prototype.get = function (options, callback) {
41
+ var params = {
42
+ qs: options,
43
+ };
44
+ var apiPath = url_path_1.default(BASE_PATH);
45
+ return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback);
46
+ };
47
+ return RecentItems;
48
+ }());
57
49
  module.exports = RecentItems;
50
+ //# sourceMappingURL=recent-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recent-items.js","sourceRoot":"","sources":["../../src/managers/recent-items.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAOH,8DAAuC;AAEvC,iFAAiF;AACjF,UAAU;AACV,iFAAiF;AAEjF,IAAM,SAAS,GAAG,eAAe,CAAC;AAElC,iFAAiF;AACjF,SAAS;AACT,iFAAiF;AAEjF;;;;;;GAMG;AACH;IAGC,qBAAY,MAAiB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,yBAAG,GAAH,UACC,OAIC,EACD,QAAmB;QAEnB,IAAI,MAAM,GAAG;YACZ,EAAE,EAAE,OAAO;SACX,CAAC;QACF,IAAI,OAAO,GAAG,kBAAO,CAAC,SAAS,CAAC,CAAC;QACjC,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,AAtCD,IAsCC;AAMD,iBAAS,WAAW,CAAC"}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * @fileoverview Manager for the Retention Policies Resource
3
+ */
4
+ import BoxClient from '../box-client';
5
+ /**
6
+ * Enum of valid retention policy types, which specify how long the policy should
7
+ * remain in effect.
8
+ * @readonly
9
+ * @enum {RetentionPolicyType}
10
+ */
11
+ declare enum RetentionPolicyType {
12
+ FINITE = "finite",
13
+ INDEFINITE = "indefinite"
14
+ }
15
+ /**
16
+ * Enum of valid retention policy disposition actions, which specify what should
17
+ * be done when the retention period is over
18
+ * @readonly
19
+ * @enum {RetentionPolicyDispositionAction}
20
+ */
21
+ declare enum RetentionPolicyDispositionAction {
22
+ PERMANENTLY_DELETE = "permanently_delete",
23
+ REMOVE_RETENTION = "remove_retention"
24
+ }
25
+ /**
26
+ * Enum of valid policy assignment types, which specify what object the policy applies to
27
+ * @readonly
28
+ * @enum {RetentionPolicyAssignmentType}
29
+ */
30
+ declare enum RetentionPolicyAssignmentType {
31
+ FOLDER = "folder",
32
+ ENTERPRISE = "enterprise",
33
+ METADATA = "metadata_template"
34
+ }
35
+ /**
36
+ * Metadata template fields to filter on for assigning a retention policy
37
+ * @typedef {Object} MetadataFilterField
38
+ * @property {string} field The field to filter on
39
+ * @property {string|int} value The value to filter against
40
+ */
41
+ declare type MetadataFilterField = {
42
+ field: string;
43
+ value: string | number;
44
+ };
45
+ /**
46
+ * Simple manager for interacting with all Retention Policies endpoints and actions.
47
+ *
48
+ * @constructor
49
+ * @param {BoxClient} client - The Box API Client that is responsible for making calls to the API
50
+ * @returns {void}
51
+ */
52
+ declare class RetentionPolicies {
53
+ client: BoxClient;
54
+ policyTypes: typeof RetentionPolicyType;
55
+ dispositionActions: typeof RetentionPolicyDispositionAction;
56
+ assignmentTypes: typeof RetentionPolicyAssignmentType;
57
+ constructor(client: BoxClient);
58
+ /**
59
+ * Used to create a single retention policy for an enterprise
60
+ *
61
+ * API Endpoint: '/retention_policies'
62
+ * Method: POST
63
+ *
64
+ * @param {string} name - The name of the retention policy to be created
65
+ * @param {RetentionPolicyType} type - The type of policy to create
66
+ * @param {RetentionPolicyDispositionAction} action - The disposition action for the new policy
67
+ * @param {Object} [options] - Additional parameters
68
+ * @param {int} [options.retention_length] - For finite policies, the number of days to retain the content
69
+ * @param {Function} [callback] - Passed the new policy information if it was acquired successfully, error otherwise
70
+ * @returns {Promise<Object>} A promise resolving to the new policy object
71
+ */
72
+ create(name: string, type: RetentionPolicyType, action: RetentionPolicyDispositionAction, options?: {
73
+ retention_length?: number;
74
+ }, callback?: Function): any;
75
+ /**
76
+ * Fetches details about a specific retention policy
77
+ *
78
+ * API Endpoint: '/retention_policies/:policyID'
79
+ * Method: GET
80
+ *
81
+ * @param {string} policyID - The Box ID of the retention policy being requested
82
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
83
+ * @param {Function} [callback] - Passed the policy information if it was acquired successfully, error otherwise
84
+ * @returns {Promise<Object>} A promise resolving to the policy object
85
+ */
86
+ get(policyID: string, options?: Record<string, any>, callback?: Function): any;
87
+ /**
88
+ * Update or modify a retention policy.
89
+ *
90
+ * API Endpoint: '/retention_policies/:policyID'
91
+ * Method: PUT
92
+ *
93
+ * @param {string} policyID - The Box ID of the retention policy to update
94
+ * @param {Object} updates - The information to be updated
95
+ * @param {string} [updates.policy_name] - The name of the retention policy
96
+ * @param {RetentionPolicyDispositionAction} [updates.disposition_action] - The disposition action for the updated policy
97
+ * @param {string} [updates.status] - Used to retire a retention policy if status is set to retired
98
+ * @param {Function} [callback] - Passed the updated policy information if it was acquired successfully, error otherwise
99
+ * @returns {Promise<Object>} A promise resolving to the updated policy object
100
+ */
101
+ update(policyID: string, updates: {
102
+ policy_name?: string;
103
+ disposition_action?: RetentionPolicyDispositionAction;
104
+ status?: string;
105
+ }, callback?: Function): any;
106
+ /**
107
+ * Fetches a list of retention policies for the enterprise
108
+ *
109
+ * API Endpoint: '/retention_policies
110
+ * Method: GET
111
+ *
112
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
113
+ * @param {string} [options.policy_name] - A full or partial name to filter the retention policies by
114
+ * @param {RetentionPolicyType} [options.policy_type] - A policy type to filter the retention policies by
115
+ * @param {string} [options.created_by_user_id] - A user id to filter the retention policies by
116
+ * @param {Function} [callback] - Passed the policy objects if they were acquired successfully, error otherwise
117
+ * @returns {Promise<Object>} A promise resolving to the collection of policies
118
+ */
119
+ getAll(options?: {
120
+ policy_name?: string;
121
+ policy_type?: RetentionPolicyType;
122
+ created_by_user_id?: string;
123
+ }, callback?: Function): any;
124
+ /**
125
+ * Fetch a list of assignments for a given retention policy
126
+ *
127
+ * API Endpoint: '/retention_policies/:policyID/assignments'
128
+ * Method: GET
129
+ *
130
+ * @param {string} policyID - The Box ID of the retention policy to get assignments for
131
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
132
+ * @param {RetentionPolicyAssignmentType} [options.type] - The type of the retention policy assignment to retrieve
133
+ * @param {Function} [callback] - Passed the assignment objects if they were acquired successfully, error otherwise
134
+ * @returns {Promise<Object>} A promise resolving to the collection of policy assignments
135
+ */
136
+ getAssignments(policyID: string, options?: {
137
+ type?: RetentionPolicyAssignmentType;
138
+ }, callback?: Function): any;
139
+ /**
140
+ * Assign a retention policy to a folder or the entire enterprise.
141
+ *
142
+ * API Endpoint: '/retention_policy_assignments
143
+ * Method: POST
144
+ *
145
+ * @param {string} policyID - The ID of the policy to assign
146
+ * @param {RetentionPolicyAssignmentType} assignType - The type of object the policy will be assigned to
147
+ * @param {string} assignID - The Box ID of the object to assign the retention policy to
148
+ * @param {Object} [options] - Optional parameters for the request
149
+ * @param {MetadataFilterField[]} [options.filter_fields] - Metadata fields to filter against, if assigning to a metadata template
150
+ * @param {Function} [callback] - Passed the new assignment object if successful, error otherwise
151
+ * @returns {Promise<Object>} A promise resolving to the created assignment object
152
+ */
153
+ assign(policyID: string, assignType: RetentionPolicyAssignmentType, assignID: string, options?: {
154
+ filter_fields?: MetadataFilterField[];
155
+ } | Function | null, callback?: Function): any;
156
+ /**
157
+ * Fetch a specific policy assignment
158
+ *
159
+ * API Endpoint: '/retention_policy_assignments/:assignmentID'
160
+ * Method: GET
161
+ *
162
+ * @param {string} assignmentID - The Box ID of the policy assignment object to fetch
163
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
164
+ * @param {Function} [callback] - Passed the assignment object if it was acquired successfully, error otherwise
165
+ * @returns {Promise<Object>} A promise resolving to the assignment object
166
+ */
167
+ getAssignment(assignmentID: string, options?: Record<string, any>, callback?: Function): any;
168
+ /**
169
+ * Get the specific retention record for a retained file version. To use this feature,
170
+ * you must have the manage retention policies scope enabled for your API key
171
+ * via your application management console.
172
+ *
173
+ * API Endpoint: '/file_version_retentions/:retentionID'
174
+ * Method: GET
175
+ *
176
+ * @param {string} retentionID - The ID for the file retention record to retrieve
177
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
178
+ * @param {Function} [callback] - Pass the file version retention record if successful, error otherwise
179
+ * @returns {Promise<Object>} A promise resolving to the retention record
180
+ */
181
+ getFileVersionRetention(retentionID: string, options?: Record<string, any>, callback?: Function): any;
182
+ /**
183
+ * Get a list of retention records for a retained file versions in an enterprise.
184
+ * To use this feature, you must have the manage retention policies scope enabled
185
+ * for your API key via your application management console.
186
+ *
187
+ * API Endpoint: '/file_version_retentions'
188
+ * Method: GET
189
+ *
190
+ * @param {Object} [options] - Additional options for the request. Can be left null in most cases.
191
+ * @param {string} [options.file_id] - A file id to filter the file version retentions by
192
+ * @param {string} [options.file_version_id] - A file version id to filter the file version retentions by
193
+ * @param {string} [options.policy_id] - A policy id to filter the file version retentions by
194
+ * @param {RetentionPolicyDispositionAction} [options.disposition_action] - The disposition action of the retention policy to filter by
195
+ * @param {string} [options.disposition_before] - Filter by retention policies which will complete before a certain time
196
+ * @param {string} [options.disposition_after] - Filter by retention policies which will complete after a certain time
197
+ * @param {int} [options.limit] - The maximum number of items to return in a page
198
+ * @param {string} [options.marker] - Paging marker, left blank to begin paging from the beginning
199
+ * @param {Function} [callback] - Pass the file version retention record if successful, error otherwise
200
+ * @returns {Promise<Object>} A promise resolving to the collection of retention records
201
+ */
202
+ getAllFileVersionRetentions(options?: {
203
+ file_id?: string;
204
+ file_version_id?: string;
205
+ policy_id?: string;
206
+ disposition_action?: RetentionPolicyDispositionAction;
207
+ disposition_before?: string;
208
+ disposition_after?: string;
209
+ limit?: number;
210
+ marker?: string;
211
+ }, callback?: Function): any;
212
+ }
213
+ export = RetentionPolicies;