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
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Manager for the Box Webhooks resource
|
|
3
|
+
*/
|
|
4
|
+
import BoxClient from '../box-client';
|
|
5
|
+
/**
|
|
6
|
+
* A webhook trigger type constant
|
|
7
|
+
* @typedef {string} WebhookTriggerType
|
|
8
|
+
*/
|
|
9
|
+
declare enum WebhookTriggerType {
|
|
10
|
+
FILE_UPLOADED = "FILE.UPLOADED",
|
|
11
|
+
FILE_PREVIEWED = "FILE.PREVIEWED",
|
|
12
|
+
FILE_DOWNLOADED = "FILE.DOWNLOADED",
|
|
13
|
+
FILE_TRASHED = "FILE.TRASHED",
|
|
14
|
+
FILE_DELETED = "FILE.DELETED",
|
|
15
|
+
FILE_RESTORED = "FILE.RESTORED",
|
|
16
|
+
FILE_COPIED = "FILE.COPIED",
|
|
17
|
+
FILE_MOVED = "FILE.MOVED",
|
|
18
|
+
FILE_LOCKED = "FILE.LOCKED",
|
|
19
|
+
FILE_UNLOCKED = "FILE.UNLOCKED",
|
|
20
|
+
FILE_RENAMED = "FILE.RENAMED",
|
|
21
|
+
COMMENT_CREATED = "COMMENT.CREATED",
|
|
22
|
+
COMMENT_UPDATED = "COMMENT.UPDATED",
|
|
23
|
+
COMMENT_DELETED = "COMMENT.DELETED",
|
|
24
|
+
TASK_ASSIGNMENT_CREATED = "TASK_ASSIGNMENT.CREATED",
|
|
25
|
+
TASK_ASSIGNMENT_UPDATED = "TASK_ASSIGNMENT.UPDATED",
|
|
26
|
+
METADATA_INSTANCE_CREATED = "METADATA_INSTANCE.CREATED",
|
|
27
|
+
METADATA_INSTANCE_UPDATED = "METADATA_INSTANCE.UPDATED",
|
|
28
|
+
METADATA_INSTANCE_DELETED = "METADATA_INSTANCE.DELETED",
|
|
29
|
+
FOLDER_CREATED = "FOLDER.CREATED",
|
|
30
|
+
FOLDER_DOWNLOADED = "FOLDER.DOWNLOADED",
|
|
31
|
+
FOLDER_RESTORED = "FOLDER.RESTORED",
|
|
32
|
+
FOLDER_DELETED = "FOLDER.DELETED",
|
|
33
|
+
FOLDER_COPIED = "FOLDER.COPIED",
|
|
34
|
+
FOLDER_MOVED = "FOLDER.MOVED",
|
|
35
|
+
FOLDER_TRASHED = "FOLDER.TRASHED",
|
|
36
|
+
FOLDER_RENAMED = "FOLDER.RENAMED",
|
|
37
|
+
WEBHOOK_DELETED = "WEBHOOK.DELETED",
|
|
38
|
+
COLLABORATION_CREATED = "COLLABORATION.CREATED",
|
|
39
|
+
COLLABORATION_ACCEPTED = "COLLABORATION.ACCEPTED",
|
|
40
|
+
COLLABORATION_REJECTED = "COLLABORATION.REJECTED",
|
|
41
|
+
COLLABORATION_REMOVED = "COLLABORATION.REMOVED",
|
|
42
|
+
COLLABORATION_UPDATED = "COLLABORATION.UPDATED",
|
|
43
|
+
SHARED_LINK_DELETED = "SHARED_LINK.DELETED",
|
|
44
|
+
SHARED_LINK_CREATED = "SHARED_LINK.CREATED",
|
|
45
|
+
SHARED_LINK_UPDATED = "SHARED_LINK.UPDATED"
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Simple manager for interacting with all 'Webhooks' endpoints and actions.
|
|
49
|
+
*
|
|
50
|
+
* @param {BoxClient} client The Box API Client that is responsible for making calls to the API
|
|
51
|
+
* @constructor
|
|
52
|
+
*/
|
|
53
|
+
declare class Webhooks {
|
|
54
|
+
/**
|
|
55
|
+
* Primary signature key to protect webhooks against attacks.
|
|
56
|
+
* @static
|
|
57
|
+
* @type {?string}
|
|
58
|
+
*/
|
|
59
|
+
static primarySignatureKey: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Secondary signature key to protect webhooks against attacks.
|
|
62
|
+
* @static
|
|
63
|
+
* @type {?string}
|
|
64
|
+
*/
|
|
65
|
+
static secondarySignatureKey: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Sets primary and secondary signatures that are used to verify the Webhooks messages
|
|
68
|
+
*
|
|
69
|
+
* @param {string} primaryKey - The primary signature to verify the message with
|
|
70
|
+
* @param {string} [secondaryKey] - The secondary signature to verify the message with
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
static setSignatureKeys(primaryKey: string, secondaryKey?: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Validate a webhook message by verifying the signature and the delivery timestamp
|
|
76
|
+
*
|
|
77
|
+
* @param {string|Object} body - The request body of the webhook message
|
|
78
|
+
* @param {Object} headers - The request headers of the webhook message
|
|
79
|
+
* @param {string} [primaryKey] - The primary signature to verify the message with. If it is sent as a parameter,
|
|
80
|
+
it overrides the static variable primarySignatureKey
|
|
81
|
+
* @param {string} [secondaryKey] - The secondary signature to verify the message with. If it is sent as a parameter,
|
|
82
|
+
it overrides the static variable primarySignatureKey
|
|
83
|
+
* @param {int} [maxMessageAge] - The maximum message age (in seconds). Defaults to 10 minutes
|
|
84
|
+
* @returns {boolean} - True or false
|
|
85
|
+
*/
|
|
86
|
+
static validateMessage(body: string | object, headers: Record<string, string>, primaryKey?: string, secondaryKey?: string, maxMessageAge?: number): boolean;
|
|
87
|
+
client: BoxClient;
|
|
88
|
+
triggerTypes: Record<'FILE' | 'COMMENT' | 'TASK_ASSIGNMENT' | 'METADATA_INSTANCE' | 'FOLDER' | 'WEBHOOK' | 'COLLABORATION' | 'SHARED_LINK', Record<string, WebhookTriggerType>>;
|
|
89
|
+
validateMessage: typeof Webhooks.validateMessage;
|
|
90
|
+
constructor(client: BoxClient);
|
|
91
|
+
/**
|
|
92
|
+
* Create a new webhook on a given Box object, specified by type and ID.
|
|
93
|
+
*
|
|
94
|
+
* API Endpoint: '/webhooks'
|
|
95
|
+
* Method: POST
|
|
96
|
+
*
|
|
97
|
+
* @param {string} targetID - Box ID of the item to create webhook on
|
|
98
|
+
* @param {ItemType} targetType - Type of item the webhook will be created on
|
|
99
|
+
* @param {string} notificationURL - The URL of your application where Box will notify you of events triggers
|
|
100
|
+
* @param {WebhookTriggerType[]} triggerTypes - Array of event types that trigger notification for the target
|
|
101
|
+
* @param {Function} [callback] - Passed the new webhook information if it was acquired successfully
|
|
102
|
+
* @returns {Promise<Object>} A promise resolving to the new webhook object
|
|
103
|
+
*/
|
|
104
|
+
create(targetID: string, targetType: string, notificationURL: string, triggerTypes: WebhookTriggerType[], callback?: Function): any;
|
|
105
|
+
/**
|
|
106
|
+
* Returns a webhook object with the specified Webhook ID
|
|
107
|
+
*
|
|
108
|
+
* API Endpoint: '/webhooks/:webhookID'
|
|
109
|
+
* Method: GET
|
|
110
|
+
*
|
|
111
|
+
* @param {string} webhookID - ID of the webhook to retrieve
|
|
112
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
113
|
+
* @param {Function} [callback] - Passed the webhook information if it was acquired successfully
|
|
114
|
+
* @returns {Promise<Object>} A promise resolving to the webhook object
|
|
115
|
+
*/
|
|
116
|
+
get(webhookID: string, options?: Record<string, any>, callback?: Function): any;
|
|
117
|
+
/**
|
|
118
|
+
* Get a list of webhooks that are active for the current application and user.
|
|
119
|
+
*
|
|
120
|
+
* API Endpoint: '/webhooks'
|
|
121
|
+
* Method: GET
|
|
122
|
+
*
|
|
123
|
+
* @param {Object} [options] - Additional options for the request. Can be left null in most cases.
|
|
124
|
+
* @param {int} [options.limit=100] - The number of webhooks to return
|
|
125
|
+
* @param {string} [options.marker] - Pagination marker
|
|
126
|
+
* @param {Function} [callback] - Passed the list of webhooks if successful, error otherwise
|
|
127
|
+
* @returns {Promise<Object>} A promise resolving to the collection of webhooks
|
|
128
|
+
*/
|
|
129
|
+
getAll(options?: {
|
|
130
|
+
limit?: number;
|
|
131
|
+
marker?: string;
|
|
132
|
+
}, callback?: Function): any;
|
|
133
|
+
/**
|
|
134
|
+
* Update a webhook
|
|
135
|
+
*
|
|
136
|
+
* API Endpoint: '/webhooks/:webhookID'
|
|
137
|
+
* Method: PUT
|
|
138
|
+
*
|
|
139
|
+
* @param {string} webhookID - The ID of the webhook to be updated
|
|
140
|
+
* @param {Object} updates - Webhook fields to update
|
|
141
|
+
* @param {string} [updates.address] - The new URL used by Box to send a notification when webhook is triggered
|
|
142
|
+
* @param {WebhookTriggerType[]} [updates.triggers] - The new events that triggers a notification
|
|
143
|
+
* @param {Function} [callback] - Passed the updated webhook information if successful, error otherwise
|
|
144
|
+
* @returns {Promise<Object>} A promise resolving to the updated webhook object
|
|
145
|
+
*/
|
|
146
|
+
update(webhookID: string, updates?: {
|
|
147
|
+
address?: string;
|
|
148
|
+
triggers?: WebhookTriggerType[];
|
|
149
|
+
}, callback?: Function): any;
|
|
150
|
+
/**
|
|
151
|
+
* Delete a specified webhook by ID
|
|
152
|
+
*
|
|
153
|
+
* API Endpoint: '/webhooks/:webhookID'
|
|
154
|
+
* Method: DELETE
|
|
155
|
+
*
|
|
156
|
+
* @param {string} webhookID - ID of webhook to be deleted
|
|
157
|
+
* @param {Function} [callback] - Empty response body passed if successful.
|
|
158
|
+
* @returns {Promise<void>} A promise resolving to nothing
|
|
159
|
+
*/
|
|
160
|
+
delete(webhookID: string, callback?: Function): any;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @module box-node-sdk/lib/managers/webhooks
|
|
164
|
+
* @see {@Link Webhooks}
|
|
165
|
+
*/
|
|
166
|
+
export = Webhooks;
|