files.com 1.0.188 → 1.0.191
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/docs/Errors.md +186 -0
- package/docs/models/AccountLineItem.md +53 -0
- package/docs/models/Action.md +37 -0
- package/docs/models/ActionNotificationExport.md +82 -0
- package/docs/models/ActionNotificationExportResult.md +49 -0
- package/docs/models/ActionWebhookFailure.md +16 -0
- package/docs/models/ApiKey.md +183 -0
- package/docs/models/App.md +66 -0
- package/docs/models/As2IncomingMessage.md +104 -0
- package/docs/models/As2OutgoingMessage.md +96 -0
- package/docs/models/As2Partner.md +141 -0
- package/docs/models/As2Station.md +142 -0
- package/docs/models/Auto.md +11 -0
- package/docs/models/Automation.md +257 -0
- package/docs/models/AutomationRun.md +61 -0
- package/docs/models/BandwidthSnapshot.md +50 -0
- package/docs/models/Behavior.md +195 -0
- package/docs/models/Bundle.md +330 -0
- package/docs/models/BundleDownload.md +44 -0
- package/docs/models/BundleRecipient.md +76 -0
- package/docs/models/BundleRegistration.md +53 -0
- package/docs/models/Clickwrap.md +120 -0
- package/docs/models/DnsRecord.md +33 -0
- package/docs/models/Errors.md +17 -0
- package/docs/models/ExternalEvent.md +84 -0
- package/docs/models/File.md +339 -0
- package/docs/models/FileAction.md +13 -0
- package/docs/models/FileComment.md +98 -0
- package/docs/models/FileCommentReaction.md +50 -0
- package/docs/models/FileMigration.md +40 -0
- package/docs/models/FileUploadPart.md +39 -0
- package/docs/models/Folder.md +90 -0
- package/docs/models/FormField.md +29 -0
- package/docs/models/FormFieldSet.md +170 -0
- package/docs/models/Group.md +140 -0
- package/docs/models/GroupUser.md +116 -0
- package/docs/models/History.md +151 -0
- package/docs/models/HistoryExport.md +130 -0
- package/docs/models/HistoryExportResult.md +75 -0
- package/docs/models/Image.md +13 -0
- package/docs/models/InboxRecipient.md +76 -0
- package/docs/models/InboxRegistration.md +47 -0
- package/docs/models/InboxUpload.md +42 -0
- package/docs/models/Invoice.md +82 -0
- package/docs/models/InvoiceLineItem.md +27 -0
- package/docs/models/IpAddress.md +51 -0
- package/docs/models/Lock.md +92 -0
- package/docs/models/Message.md +134 -0
- package/docs/models/MessageComment.md +114 -0
- package/docs/models/MessageCommentReaction.md +79 -0
- package/docs/models/MessageReaction.md +79 -0
- package/docs/models/Notification.md +241 -0
- package/docs/models/Payment.md +82 -0
- package/docs/models/PaymentLineItem.md +19 -0
- package/docs/models/Permission.md +94 -0
- package/docs/models/Preview.md +19 -0
- package/docs/models/Priority.md +30 -0
- package/docs/models/Project.md +98 -0
- package/docs/models/PublicIpAddress.md +17 -0
- package/docs/models/PublicKey.md +112 -0
- package/docs/models/RemoteBandwidthSnapshot.md +42 -0
- package/docs/models/RemoteServer.md +385 -0
- package/docs/models/Request.md +97 -0
- package/docs/models/Session.md +50 -0
- package/docs/models/SettingsChange.md +44 -0
- package/docs/models/Site.md +607 -0
- package/docs/models/SsoStrategy.md +139 -0
- package/docs/models/Status.md +30 -0
- package/docs/models/Style.md +76 -0
- package/docs/models/UsageDailySnapshot.md +56 -0
- package/docs/models/UsageSnapshot.md +63 -0
- package/docs/models/User.md +465 -0
- package/docs/models/UserCipherUse.md +39 -0
- package/docs/models/UserRequest.md +80 -0
- package/docs/models/WebhookTest.md +59 -0
- package/lib/Api.js +12 -11
- package/lib/Errors.js +3126 -0
- package/lib/models/AccountLineItem.js +8 -0
- package/lib/models/Action.js +8 -0
- package/lib/models/ActionNotificationExport.js +21 -13
- package/lib/models/ActionNotificationExportResult.js +13 -5
- package/lib/models/ActionWebhookFailure.js +12 -4
- package/lib/models/ApiKey.js +33 -25
- package/lib/models/App.js +10 -2
- package/lib/models/As2IncomingMessage.js +11 -3
- package/lib/models/As2OutgoingMessage.js +11 -3
- package/lib/models/As2Partner.js +34 -26
- package/lib/models/As2Station.js +32 -24
- package/lib/models/Auto.js +8 -0
- package/lib/models/Automation.js +54 -60
- package/lib/models/AutomationRun.js +16 -8
- package/lib/models/BandwidthSnapshot.js +10 -2
- package/lib/models/Behavior.js +46 -38
- package/lib/models/Bundle.js +51 -43
- package/lib/models/BundleDownload.js +12 -4
- package/lib/models/BundleRecipient.js +22 -14
- package/lib/models/BundleRegistration.js +12 -4
- package/lib/models/Clickwrap.js +31 -23
- package/lib/models/DnsRecord.js +10 -2
- package/lib/models/Errors.js +8 -0
- package/lib/models/ExternalEvent.js +18 -10
- package/lib/models/File.js +68 -60
- package/lib/models/FileAction.js +8 -0
- package/lib/models/FileComment.js +27 -19
- package/lib/models/FileCommentReaction.js +18 -10
- package/lib/models/FileMigration.js +11 -3
- package/lib/models/FileUploadPart.js +8 -0
- package/lib/models/Folder.js +19 -11
- package/lib/models/FormField.js +8 -0
- package/lib/models/FormFieldSet.js +27 -19
- package/lib/models/Group.js +30 -22
- package/lib/models/GroupUser.js +32 -24
- package/lib/models/History.js +42 -34
- package/lib/models/HistoryExport.js +34 -26
- package/lib/models/HistoryExportResult.js +13 -5
- package/lib/models/Image.js +8 -0
- package/lib/models/InboxRecipient.js +22 -14
- package/lib/models/InboxRegistration.js +11 -3
- package/lib/models/InboxUpload.js +12 -4
- package/lib/models/Invoice.js +13 -5
- package/lib/models/InvoiceLineItem.js +8 -0
- package/lib/models/IpAddress.js +12 -4
- package/lib/models/Lock.js +24 -16
- package/lib/models/Message.js +37 -29
- package/lib/models/MessageComment.js +29 -21
- package/lib/models/MessageCommentReaction.js +24 -16
- package/lib/models/MessageReaction.js +24 -16
- package/lib/models/Notification.js +38 -30
- package/lib/models/Payment.js +13 -5
- package/lib/models/PaymentLineItem.js +8 -0
- package/lib/models/Permission.js +23 -15
- package/lib/models/Preview.js +8 -0
- package/lib/models/Priority.js +13 -5
- package/lib/models/Project.js +25 -17
- package/lib/models/PublicIpAddress.js +8 -0
- package/lib/models/PublicKey.js +29 -21
- package/lib/models/RemoteBandwidthSnapshot.js +10 -2
- package/lib/models/RemoteServer.js +226 -196
- package/lib/models/Request.js +27 -19
- package/lib/models/Session.js +13 -5
- package/lib/models/SettingsChange.js +10 -2
- package/lib/models/Site.js +65 -57
- package/lib/models/SsoStrategy.js +17 -9
- package/lib/models/Status.js +8 -0
- package/lib/models/Style.js +20 -12
- package/lib/models/UsageDailySnapshot.js +10 -2
- package/lib/models/UsageSnapshot.js +10 -2
- package/lib/models/User.js +85 -77
- package/lib/models/UserCipherUse.js +11 -3
- package/lib/models/UserRequest.js +24 -16
- package/lib/models/WebhookTest.js +16 -8
- package/package.json +1 -1
- package/src/Api.js +4 -8
- package/src/Errors.js +222 -0
- package/src/models/AccountLineItem.js +1 -0
- package/src/models/Action.js +1 -0
- package/src/models/ActionNotificationExport.js +14 -13
- package/src/models/ActionNotificationExportResult.js +6 -5
- package/src/models/ActionWebhookFailure.js +5 -4
- package/src/models/ApiKey.js +26 -25
- package/src/models/App.js +3 -2
- package/src/models/As2IncomingMessage.js +4 -3
- package/src/models/As2OutgoingMessage.js +4 -3
- package/src/models/As2Partner.js +27 -26
- package/src/models/As2Station.js +25 -24
- package/src/models/Auto.js +1 -0
- package/src/models/Automation.js +51 -62
- package/src/models/AutomationRun.js +9 -8
- package/src/models/BandwidthSnapshot.js +3 -2
- package/src/models/Behavior.js +39 -38
- package/src/models/Bundle.js +44 -43
- package/src/models/BundleDownload.js +5 -4
- package/src/models/BundleRecipient.js +15 -14
- package/src/models/BundleRegistration.js +5 -4
- package/src/models/Clickwrap.js +24 -23
- package/src/models/DnsRecord.js +3 -2
- package/src/models/Errors.js +1 -0
- package/src/models/ExternalEvent.js +11 -10
- package/src/models/File.js +61 -60
- package/src/models/FileAction.js +1 -0
- package/src/models/FileComment.js +20 -19
- package/src/models/FileCommentReaction.js +11 -10
- package/src/models/FileMigration.js +4 -3
- package/src/models/FileUploadPart.js +1 -0
- package/src/models/Folder.js +12 -11
- package/src/models/FormField.js +1 -0
- package/src/models/FormFieldSet.js +20 -19
- package/src/models/Group.js +23 -22
- package/src/models/GroupUser.js +25 -24
- package/src/models/History.js +35 -34
- package/src/models/HistoryExport.js +27 -26
- package/src/models/HistoryExportResult.js +6 -5
- package/src/models/Image.js +1 -0
- package/src/models/InboxRecipient.js +15 -14
- package/src/models/InboxRegistration.js +4 -3
- package/src/models/InboxUpload.js +5 -4
- package/src/models/Invoice.js +6 -5
- package/src/models/InvoiceLineItem.js +1 -0
- package/src/models/IpAddress.js +5 -4
- package/src/models/Lock.js +17 -16
- package/src/models/Message.js +30 -29
- package/src/models/MessageComment.js +22 -21
- package/src/models/MessageCommentReaction.js +17 -16
- package/src/models/MessageReaction.js +17 -16
- package/src/models/Notification.js +31 -30
- package/src/models/Payment.js +6 -5
- package/src/models/PaymentLineItem.js +1 -0
- package/src/models/Permission.js +16 -15
- package/src/models/Preview.js +3 -2
- package/src/models/Priority.js +6 -5
- package/src/models/Project.js +18 -17
- package/src/models/PublicIpAddress.js +1 -0
- package/src/models/PublicKey.js +22 -21
- package/src/models/RemoteBandwidthSnapshot.js +3 -2
- package/src/models/RemoteServer.js +120 -103
- package/src/models/Request.js +20 -19
- package/src/models/Session.js +6 -5
- package/src/models/SettingsChange.js +3 -2
- package/src/models/Site.js +58 -57
- package/src/models/SsoStrategy.js +10 -9
- package/src/models/Status.js +1 -0
- package/src/models/Style.js +13 -12
- package/src/models/UsageDailySnapshot.js +3 -2
- package/src/models/UsageSnapshot.js +3 -2
- package/src/models/User.js +78 -77
- package/src/models/UserCipherUse.js +4 -3
- package/src/models/UserRequest.js +17 -16
- package/src/models/WebhookTest.js +9 -8
- package/test/src/index.js +46 -0
package/src/models/Automation.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
2
3
|
import Logger from '../Logger'
|
3
4
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
5
|
|
@@ -176,13 +177,6 @@ class Automation {
|
|
176
177
|
this.attributes.destination = value
|
177
178
|
}
|
178
179
|
|
179
|
-
// int64 # Set to the ID of automation used a clone template. For
|
180
|
-
getClonedFrom = () => this.attributes.cloned_from
|
181
|
-
|
182
|
-
setClonedFrom = value => {
|
183
|
-
this.attributes.cloned_from = value
|
184
|
-
}
|
185
|
-
|
186
180
|
|
187
181
|
// Parameters:
|
188
182
|
// source - string - Source Path
|
@@ -204,65 +198,65 @@ class Automation {
|
|
204
198
|
// automation - string - Automation type
|
205
199
|
update = async (params = {}) => {
|
206
200
|
if (!this.attributes.id) {
|
207
|
-
throw new
|
201
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
208
202
|
}
|
209
203
|
|
210
204
|
if (!isObject(params)) {
|
211
|
-
throw new
|
205
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
212
206
|
}
|
213
207
|
|
214
208
|
params.id = this.attributes.id
|
215
209
|
if (params['id'] && !isInt(params['id'])) {
|
216
|
-
throw new
|
210
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
217
211
|
}
|
218
212
|
if (params['source'] && !isString(params['source'])) {
|
219
|
-
throw new
|
213
|
+
throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(source)}`)
|
220
214
|
}
|
221
215
|
if (params['destination'] && !isString(params['destination'])) {
|
222
|
-
throw new
|
216
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
|
223
217
|
}
|
224
218
|
if (params['destinations'] && !isArray(params['destinations'])) {
|
225
|
-
throw new
|
219
|
+
throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(destinations)}`)
|
226
220
|
}
|
227
221
|
if (params['destination_replace_from'] && !isString(params['destination_replace_from'])) {
|
228
|
-
throw new
|
222
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(destination_replace_from)}`)
|
229
223
|
}
|
230
224
|
if (params['destination_replace_to'] && !isString(params['destination_replace_to'])) {
|
231
|
-
throw new
|
225
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(destination_replace_to)}`)
|
232
226
|
}
|
233
227
|
if (params['interval'] && !isString(params['interval'])) {
|
234
|
-
throw new
|
228
|
+
throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(interval)}`)
|
235
229
|
}
|
236
230
|
if (params['path'] && !isString(params['path'])) {
|
237
|
-
throw new
|
231
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
238
232
|
}
|
239
233
|
if (params['user_ids'] && !isString(params['user_ids'])) {
|
240
|
-
throw new
|
234
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(user_ids)}`)
|
241
235
|
}
|
242
236
|
if (params['group_ids'] && !isString(params['group_ids'])) {
|
243
|
-
throw new
|
237
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
|
244
238
|
}
|
245
239
|
if (params['description'] && !isString(params['description'])) {
|
246
|
-
throw new
|
240
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(description)}`)
|
247
241
|
}
|
248
242
|
if (params['name'] && !isString(params['name'])) {
|
249
|
-
throw new
|
243
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
250
244
|
}
|
251
245
|
if (params['trigger'] && !isString(params['trigger'])) {
|
252
|
-
throw new
|
246
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(trigger)}`)
|
253
247
|
}
|
254
248
|
if (params['trigger_actions'] && !isArray(params['trigger_actions'])) {
|
255
|
-
throw new
|
249
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
|
256
250
|
}
|
257
251
|
if (params['automation'] && !isString(params['automation'])) {
|
258
|
-
throw new
|
252
|
+
throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
|
259
253
|
}
|
260
254
|
|
261
255
|
if (!params['id']) {
|
262
256
|
if (this.attributes.id) {
|
263
257
|
params['id'] = this.id
|
264
258
|
} else {
|
265
|
-
throw new
|
259
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
266
260
|
}
|
267
261
|
}
|
268
262
|
|
@@ -273,23 +267,23 @@ class Automation {
|
|
273
267
|
|
274
268
|
delete = async (params = {}) => {
|
275
269
|
if (!this.attributes.id) {
|
276
|
-
throw new
|
270
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
277
271
|
}
|
278
272
|
|
279
273
|
if (!isObject(params)) {
|
280
|
-
throw new
|
274
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
281
275
|
}
|
282
276
|
|
283
277
|
params.id = this.attributes.id
|
284
278
|
if (params['id'] && !isInt(params['id'])) {
|
285
|
-
throw new
|
279
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
286
280
|
}
|
287
281
|
|
288
282
|
if (!params['id']) {
|
289
283
|
if (this.attributes.id) {
|
290
284
|
params['id'] = this.id
|
291
285
|
} else {
|
292
|
-
throw new
|
286
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
293
287
|
}
|
294
288
|
}
|
295
289
|
|
@@ -314,26 +308,26 @@ class Automation {
|
|
314
308
|
// Parameters:
|
315
309
|
// cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
316
310
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
317
|
-
// sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `automation`, `
|
318
|
-
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ disabled, automation ]`.
|
319
|
-
// filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ disabled, automation ]`.
|
320
|
-
// filter_gteq - object - If set, return records where the specified field is greater than or equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ disabled, automation ]`.
|
321
|
-
// filter_like - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ disabled, automation ]`.
|
322
|
-
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ disabled, automation ]`.
|
323
|
-
// filter_lteq - object - If set, return records where the specified field is less than or equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ disabled, automation ]`.
|
311
|
+
// sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `automation`, `disabled` or `last_modified_at`.
|
312
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ automation, disabled ]` and `[ disabled, automation ]`.
|
313
|
+
// filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ automation, disabled ]` and `[ disabled, automation ]`.
|
314
|
+
// filter_gteq - object - If set, return records where the specified field is greater than or equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ automation, disabled ]` and `[ disabled, automation ]`.
|
315
|
+
// filter_like - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ automation, disabled ]` and `[ disabled, automation ]`.
|
316
|
+
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ automation, disabled ]` and `[ disabled, automation ]`.
|
317
|
+
// filter_lteq - object - If set, return records where the specified field is less than or equal to the supplied value. Valid fields are `automation`, `last_modified_at` or `disabled`. Valid field combinations are `[ automation, disabled ]` and `[ disabled, automation ]`.
|
324
318
|
// with_deleted - boolean - Set to true to include deleted automations in the results.
|
325
319
|
// automation - string - DEPRECATED: Type of automation to filter by. Use `filter[automation]` instead.
|
326
320
|
static list = async (params = {}, options = {}) => {
|
327
321
|
if (params['cursor'] && !isString(params['cursor'])) {
|
328
|
-
throw new
|
322
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
329
323
|
}
|
330
324
|
|
331
325
|
if (params['per_page'] && !isInt(params['per_page'])) {
|
332
|
-
throw new
|
326
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
333
327
|
}
|
334
328
|
|
335
329
|
if (params['automation'] && !isString(params['automation'])) {
|
336
|
-
throw new
|
330
|
+
throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
|
337
331
|
}
|
338
332
|
|
339
333
|
const response = await Api.sendRequest(`/automations`, 'GET', params, options)
|
@@ -348,17 +342,17 @@ class Automation {
|
|
348
342
|
// id (required) - int64 - Automation ID.
|
349
343
|
static find = async (id, params = {}, options = {}) => {
|
350
344
|
if (!isObject(params)) {
|
351
|
-
throw new
|
345
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
352
346
|
}
|
353
347
|
|
354
348
|
params['id'] = id
|
355
349
|
|
356
350
|
if (!params['id']) {
|
357
|
-
throw new
|
351
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
358
352
|
}
|
359
353
|
|
360
354
|
if (params['id'] && !isInt(params['id'])) {
|
361
|
-
throw new
|
355
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
362
356
|
}
|
363
357
|
|
364
358
|
const response = await Api.sendRequest(`/automations/${params['id']}`, 'GET', params, options)
|
@@ -387,70 +381,65 @@ class Automation {
|
|
387
381
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
388
382
|
// value - object - A Hash of attributes specific to the automation type.
|
389
383
|
// automation (required) - string - Automation type
|
390
|
-
// cloned_from - int64 - Set to the ID of automation used a clone template. For
|
391
384
|
static create = async (params = {}, options = {}) => {
|
392
385
|
if (!params['automation']) {
|
393
|
-
throw new
|
386
|
+
throw new errors.MissingParameterError('Parameter missing: automation')
|
394
387
|
}
|
395
388
|
|
396
389
|
if (params['source'] && !isString(params['source'])) {
|
397
|
-
throw new
|
390
|
+
throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(source)}`)
|
398
391
|
}
|
399
392
|
|
400
393
|
if (params['destination'] && !isString(params['destination'])) {
|
401
|
-
throw new
|
394
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
|
402
395
|
}
|
403
396
|
|
404
397
|
if (params['destinations'] && !isArray(params['destinations'])) {
|
405
|
-
throw new
|
398
|
+
throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(destinations)}`)
|
406
399
|
}
|
407
400
|
|
408
401
|
if (params['destination_replace_from'] && !isString(params['destination_replace_from'])) {
|
409
|
-
throw new
|
402
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(destination_replace_from)}`)
|
410
403
|
}
|
411
404
|
|
412
405
|
if (params['destination_replace_to'] && !isString(params['destination_replace_to'])) {
|
413
|
-
throw new
|
406
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(destination_replace_to)}`)
|
414
407
|
}
|
415
408
|
|
416
409
|
if (params['interval'] && !isString(params['interval'])) {
|
417
|
-
throw new
|
410
|
+
throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(interval)}`)
|
418
411
|
}
|
419
412
|
|
420
413
|
if (params['path'] && !isString(params['path'])) {
|
421
|
-
throw new
|
414
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
422
415
|
}
|
423
416
|
|
424
417
|
if (params['user_ids'] && !isString(params['user_ids'])) {
|
425
|
-
throw new
|
418
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(user_ids)}`)
|
426
419
|
}
|
427
420
|
|
428
421
|
if (params['group_ids'] && !isString(params['group_ids'])) {
|
429
|
-
throw new
|
422
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
|
430
423
|
}
|
431
424
|
|
432
425
|
if (params['description'] && !isString(params['description'])) {
|
433
|
-
throw new
|
426
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(description)}`)
|
434
427
|
}
|
435
428
|
|
436
429
|
if (params['name'] && !isString(params['name'])) {
|
437
|
-
throw new
|
430
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
438
431
|
}
|
439
432
|
|
440
433
|
if (params['trigger'] && !isString(params['trigger'])) {
|
441
|
-
throw new
|
434
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(trigger)}`)
|
442
435
|
}
|
443
436
|
|
444
437
|
if (params['trigger_actions'] && !isArray(params['trigger_actions'])) {
|
445
|
-
throw new
|
438
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
|
446
439
|
}
|
447
440
|
|
448
441
|
if (params['automation'] && !isString(params['automation'])) {
|
449
|
-
throw new
|
450
|
-
}
|
451
|
-
|
452
|
-
if (params['cloned_from'] && !isInt(params['cloned_from'])) {
|
453
|
-
throw new Error(`Bad parameter: cloned_from must be of type Int, received ${getType(cloned_from)}`)
|
442
|
+
throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
|
454
443
|
}
|
455
444
|
|
456
445
|
const response = await Api.sendRequest(`/automations`, 'POST', params, options)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
2
3
|
import Logger from '../Logger'
|
3
4
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
5
|
|
@@ -55,23 +56,23 @@ class AutomationRun {
|
|
55
56
|
// automation_id (required) - int64 - ID of the associated Automation.
|
56
57
|
static list = async (params = {}, options = {}) => {
|
57
58
|
if (!params['automation_id']) {
|
58
|
-
throw new
|
59
|
+
throw new errors.MissingParameterError('Parameter missing: automation_id')
|
59
60
|
}
|
60
61
|
|
61
62
|
if (params['user_id'] && !isInt(params['user_id'])) {
|
62
|
-
throw new
|
63
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(user_id)}`)
|
63
64
|
}
|
64
65
|
|
65
66
|
if (params['cursor'] && !isString(params['cursor'])) {
|
66
|
-
throw new
|
67
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
67
68
|
}
|
68
69
|
|
69
70
|
if (params['per_page'] && !isInt(params['per_page'])) {
|
70
|
-
throw new
|
71
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
71
72
|
}
|
72
73
|
|
73
74
|
if (params['automation_id'] && !isInt(params['automation_id'])) {
|
74
|
-
throw new
|
75
|
+
throw new errors.InvalidParameterError(`Bad parameter: automation_id must be of type Int, received ${getType(automation_id)}`)
|
75
76
|
}
|
76
77
|
|
77
78
|
const response = await Api.sendRequest(`/automation_runs`, 'GET', params, options)
|
@@ -86,17 +87,17 @@ class AutomationRun {
|
|
86
87
|
// id (required) - int64 - Automation Run ID.
|
87
88
|
static find = async (id, params = {}, options = {}) => {
|
88
89
|
if (!isObject(params)) {
|
89
|
-
throw new
|
90
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
90
91
|
}
|
91
92
|
|
92
93
|
params['id'] = id
|
93
94
|
|
94
95
|
if (!params['id']) {
|
95
|
-
throw new
|
96
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
96
97
|
}
|
97
98
|
|
98
99
|
if (params['id'] && !isInt(params['id'])) {
|
99
|
-
throw new
|
100
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
100
101
|
}
|
101
102
|
|
102
103
|
const response = await Api.sendRequest(`/automation_runs/${params['id']}`, 'GET', params, options)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
2
3
|
import Logger from '../Logger'
|
3
4
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
5
|
|
@@ -62,11 +63,11 @@ class BandwidthSnapshot {
|
|
62
63
|
// filter_lteq - object - If set, return records where the specified field is less than or equal to the supplied value. Valid fields are `logged_at`.
|
63
64
|
static list = async (params = {}, options = {}) => {
|
64
65
|
if (params['cursor'] && !isString(params['cursor'])) {
|
65
|
-
throw new
|
66
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
66
67
|
}
|
67
68
|
|
68
69
|
if (params['per_page'] && !isInt(params['per_page'])) {
|
69
|
-
throw new
|
70
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
70
71
|
}
|
71
72
|
|
72
73
|
const response = await Api.sendRequest(`/bandwidth_snapshots`, 'GET', params, options)
|
package/src/models/Behavior.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
2
3
|
import Logger from '../Logger'
|
3
4
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
5
|
|
@@ -96,38 +97,38 @@ class Behavior {
|
|
96
97
|
// attachment_delete - boolean - If true, will delete the file stored in attachment
|
97
98
|
update = async (params = {}) => {
|
98
99
|
if (!this.attributes.id) {
|
99
|
-
throw new
|
100
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
100
101
|
}
|
101
102
|
|
102
103
|
if (!isObject(params)) {
|
103
|
-
throw new
|
104
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
104
105
|
}
|
105
106
|
|
106
107
|
params.id = this.attributes.id
|
107
108
|
if (params['id'] && !isInt(params['id'])) {
|
108
|
-
throw new
|
109
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
109
110
|
}
|
110
111
|
if (params['value'] && !isString(params['value'])) {
|
111
|
-
throw new
|
112
|
+
throw new errors.InvalidParameterError(`Bad parameter: value must be of type String, received ${getType(value)}`)
|
112
113
|
}
|
113
114
|
if (params['name'] && !isString(params['name'])) {
|
114
|
-
throw new
|
115
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
115
116
|
}
|
116
117
|
if (params['description'] && !isString(params['description'])) {
|
117
|
-
throw new
|
118
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(description)}`)
|
118
119
|
}
|
119
120
|
if (params['behavior'] && !isString(params['behavior'])) {
|
120
|
-
throw new
|
121
|
+
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(behavior)}`)
|
121
122
|
}
|
122
123
|
if (params['path'] && !isString(params['path'])) {
|
123
|
-
throw new
|
124
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
124
125
|
}
|
125
126
|
|
126
127
|
if (!params['id']) {
|
127
128
|
if (this.attributes.id) {
|
128
129
|
params['id'] = this.id
|
129
130
|
} else {
|
130
|
-
throw new
|
131
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
131
132
|
}
|
132
133
|
}
|
133
134
|
|
@@ -138,23 +139,23 @@ class Behavior {
|
|
138
139
|
|
139
140
|
delete = async (params = {}) => {
|
140
141
|
if (!this.attributes.id) {
|
141
|
-
throw new
|
142
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
142
143
|
}
|
143
144
|
|
144
145
|
if (!isObject(params)) {
|
145
|
-
throw new
|
146
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
146
147
|
}
|
147
148
|
|
148
149
|
params.id = this.attributes.id
|
149
150
|
if (params['id'] && !isInt(params['id'])) {
|
150
|
-
throw new
|
151
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
151
152
|
}
|
152
153
|
|
153
154
|
if (!params['id']) {
|
154
155
|
if (this.attributes.id) {
|
155
156
|
params['id'] = this.id
|
156
157
|
} else {
|
157
|
-
throw new
|
158
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
158
159
|
}
|
159
160
|
}
|
160
161
|
|
@@ -189,15 +190,15 @@ class Behavior {
|
|
189
190
|
// behavior - string - If set, only shows folder behaviors matching this behavior type.
|
190
191
|
static list = async (params = {}, options = {}) => {
|
191
192
|
if (params['cursor'] && !isString(params['cursor'])) {
|
192
|
-
throw new
|
193
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
193
194
|
}
|
194
195
|
|
195
196
|
if (params['per_page'] && !isInt(params['per_page'])) {
|
196
|
-
throw new
|
197
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
197
198
|
}
|
198
199
|
|
199
200
|
if (params['behavior'] && !isString(params['behavior'])) {
|
200
|
-
throw new
|
201
|
+
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(behavior)}`)
|
201
202
|
}
|
202
203
|
|
203
204
|
const response = await Api.sendRequest(`/behaviors`, 'GET', params, options)
|
@@ -212,17 +213,17 @@ class Behavior {
|
|
212
213
|
// id (required) - int64 - Behavior ID.
|
213
214
|
static find = async (id, params = {}, options = {}) => {
|
214
215
|
if (!isObject(params)) {
|
215
|
-
throw new
|
216
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
216
217
|
}
|
217
218
|
|
218
219
|
params['id'] = id
|
219
220
|
|
220
221
|
if (!params['id']) {
|
221
|
-
throw new
|
222
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
222
223
|
}
|
223
224
|
|
224
225
|
if (params['id'] && !isInt(params['id'])) {
|
225
|
-
throw new
|
226
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
226
227
|
}
|
227
228
|
|
228
229
|
const response = await Api.sendRequest(`/behaviors/${params['id']}`, 'GET', params, options)
|
@@ -248,33 +249,33 @@ class Behavior {
|
|
248
249
|
// behavior - string - DEPRECATED: If set only shows folder behaviors matching this behavior type. Use `filter[behavior]` instead.
|
249
250
|
static listFor = async (path, params = {}, options = {}) => {
|
250
251
|
if (!isObject(params)) {
|
251
|
-
throw new
|
252
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
252
253
|
}
|
253
254
|
|
254
255
|
params['path'] = path
|
255
256
|
|
256
257
|
if (!params['path']) {
|
257
|
-
throw new
|
258
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
258
259
|
}
|
259
260
|
|
260
261
|
if (params['cursor'] && !isString(params['cursor'])) {
|
261
|
-
throw new
|
262
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
262
263
|
}
|
263
264
|
|
264
265
|
if (params['per_page'] && !isInt(params['per_page'])) {
|
265
|
-
throw new
|
266
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
266
267
|
}
|
267
268
|
|
268
269
|
if (params['path'] && !isString(params['path'])) {
|
269
|
-
throw new
|
270
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
270
271
|
}
|
271
272
|
|
272
273
|
if (params['recursive'] && !isString(params['recursive'])) {
|
273
|
-
throw new
|
274
|
+
throw new errors.InvalidParameterError(`Bad parameter: recursive must be of type String, received ${getType(recursive)}`)
|
274
275
|
}
|
275
276
|
|
276
277
|
if (params['behavior'] && !isString(params['behavior'])) {
|
277
|
-
throw new
|
278
|
+
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(behavior)}`)
|
278
279
|
}
|
279
280
|
|
280
281
|
const response = await Api.sendRequest(`/behaviors/folders/${params['path']}`, 'GET', params, options)
|
@@ -291,31 +292,31 @@ class Behavior {
|
|
291
292
|
// behavior (required) - string - Behavior type.
|
292
293
|
static create = async (params = {}, options = {}) => {
|
293
294
|
if (!params['path']) {
|
294
|
-
throw new
|
295
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
295
296
|
}
|
296
297
|
|
297
298
|
if (!params['behavior']) {
|
298
|
-
throw new
|
299
|
+
throw new errors.MissingParameterError('Parameter missing: behavior')
|
299
300
|
}
|
300
301
|
|
301
302
|
if (params['value'] && !isString(params['value'])) {
|
302
|
-
throw new
|
303
|
+
throw new errors.InvalidParameterError(`Bad parameter: value must be of type String, received ${getType(value)}`)
|
303
304
|
}
|
304
305
|
|
305
306
|
if (params['name'] && !isString(params['name'])) {
|
306
|
-
throw new
|
307
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
307
308
|
}
|
308
309
|
|
309
310
|
if (params['description'] && !isString(params['description'])) {
|
310
|
-
throw new
|
311
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(description)}`)
|
311
312
|
}
|
312
313
|
|
313
314
|
if (params['path'] && !isString(params['path'])) {
|
314
|
-
throw new
|
315
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
315
316
|
}
|
316
317
|
|
317
318
|
if (params['behavior'] && !isString(params['behavior'])) {
|
318
|
-
throw new
|
319
|
+
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(behavior)}`)
|
319
320
|
}
|
320
321
|
|
321
322
|
const response = await Api.sendRequest(`/behaviors`, 'POST', params, options)
|
@@ -332,23 +333,23 @@ class Behavior {
|
|
332
333
|
// action - string - action for test body
|
333
334
|
static webhookTest = async (params = {}, options = {}) => {
|
334
335
|
if (!params['url']) {
|
335
|
-
throw new
|
336
|
+
throw new errors.MissingParameterError('Parameter missing: url')
|
336
337
|
}
|
337
338
|
|
338
339
|
if (params['url'] && !isString(params['url'])) {
|
339
|
-
throw new
|
340
|
+
throw new errors.InvalidParameterError(`Bad parameter: url must be of type String, received ${getType(url)}`)
|
340
341
|
}
|
341
342
|
|
342
343
|
if (params['method'] && !isString(params['method'])) {
|
343
|
-
throw new
|
344
|
+
throw new errors.InvalidParameterError(`Bad parameter: method must be of type String, received ${getType(method)}`)
|
344
345
|
}
|
345
346
|
|
346
347
|
if (params['encoding'] && !isString(params['encoding'])) {
|
347
|
-
throw new
|
348
|
+
throw new errors.InvalidParameterError(`Bad parameter: encoding must be of type String, received ${getType(encoding)}`)
|
348
349
|
}
|
349
350
|
|
350
351
|
if (params['action'] && !isString(params['action'])) {
|
351
|
-
throw new
|
352
|
+
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(action)}`)
|
352
353
|
}
|
353
354
|
|
354
355
|
const response = await Api.sendRequest(`/behaviors/webhook/test`, 'POST', params, options)
|