files.com 1.1.18 → 1.2.0
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/.eslintrc.js +0 -3
- package/_VERSION +1 -1
- package/docs/Errors.md +1 -0
- package/lib/Api.js +1 -1
- package/lib/Errors.js +957 -933
- package/lib/Files.js +1 -1
- package/lib/models/ActionNotificationExport.js +25 -25
- package/lib/models/ActionNotificationExportResult.js +10 -10
- package/lib/models/ActionWebhookFailure.js +5 -9
- package/lib/models/ApiKey.js +62 -70
- package/lib/models/App.js +5 -5
- package/lib/models/As2IncomingMessage.js +7 -7
- package/lib/models/As2OutgoingMessage.js +7 -7
- package/lib/models/As2Partner.js +54 -58
- package/lib/models/As2Station.js +51 -55
- package/lib/models/Automation.js +102 -110
- package/lib/models/AutomationRun.js +13 -13
- package/lib/models/BandwidthSnapshot.js +5 -5
- package/lib/models/Behavior.js +77 -85
- package/lib/models/Bundle.js +102 -110
- package/lib/models/BundleDownload.js +9 -9
- package/lib/models/BundleNotification.js +37 -41
- package/lib/models/BundleRecipient.js +22 -22
- package/lib/models/BundleRegistration.js +7 -7
- package/lib/models/Clickwrap.js +52 -56
- package/lib/models/DnsRecord.js +5 -5
- package/lib/models/EmailIncomingMessage.js +5 -5
- package/lib/models/ExternalEvent.js +18 -18
- package/lib/models/File.js +89 -93
- package/lib/models/FileComment.js +41 -45
- package/lib/models/FileCommentReaction.js +15 -19
- package/lib/models/FileMigration.js +5 -5
- package/lib/models/Folder.js +24 -24
- package/lib/models/FormFieldSet.js +44 -48
- package/lib/models/GpgKey.js +53 -57
- package/lib/models/Group.js +51 -55
- package/lib/models/GroupUser.js +53 -57
- package/lib/models/History.js +72 -72
- package/lib/models/HistoryExport.js +51 -51
- package/lib/models/HistoryExportResult.js +10 -10
- package/lib/models/InboxRecipient.js +22 -22
- package/lib/models/InboxRegistration.js +7 -7
- package/lib/models/InboxUpload.js +9 -9
- package/lib/models/Invoice.js +12 -12
- package/lib/models/IpAddress.js +17 -17
- package/lib/models/Lock.js +27 -31
- package/lib/models/Message.js +60 -64
- package/lib/models/MessageComment.js +46 -50
- package/lib/models/MessageCommentReaction.js +27 -31
- package/lib/models/MessageReaction.js +27 -31
- package/lib/models/Notification.js +66 -70
- package/lib/models/Payment.js +12 -12
- package/lib/models/Permission.js +28 -32
- package/lib/models/Priority.js +9 -9
- package/lib/models/Project.js +39 -43
- package/lib/models/PublicKey.js +46 -50
- package/lib/models/RemoteBandwidthSnapshot.js +5 -5
- package/lib/models/RemoteServer.js +306 -310
- package/lib/models/Request.js +33 -37
- package/lib/models/Session.js +11 -15
- package/lib/models/SettingsChange.js +5 -5
- package/lib/models/SftpHostKey.js +40 -44
- package/lib/models/ShareGroup.js +50 -54
- package/lib/models/Site.js +138 -138
- package/lib/models/Snapshot.js +44 -48
- package/lib/models/SsoStrategy.js +15 -19
- package/lib/models/Style.js +17 -21
- package/lib/models/UsageDailySnapshot.js +5 -5
- package/lib/models/UsageSnapshot.js +5 -5
- package/lib/models/User.js +156 -172
- package/lib/models/UserCipherUse.js +7 -7
- package/lib/models/UserRequest.js +26 -30
- package/lib/models/WebhookTest.js +15 -15
- package/package.json +6 -2
- package/src/Api.js +2 -1
- package/src/Errors.js +189 -177
- package/src/Files.js +1 -1
- package/src/models/AccountLineItem.js +5 -2
- package/src/models/Action.js +5 -2
- package/src/models/ActionNotificationExport.js +36 -35
- package/src/models/ActionNotificationExportResult.js +15 -13
- package/src/models/ActionWebhookFailure.js +9 -8
- package/src/models/ApiKey.js +69 -72
- package/src/models/App.js +10 -8
- package/src/models/As2IncomingMessage.js +12 -10
- package/src/models/As2OutgoingMessage.js +12 -10
- package/src/models/As2Partner.js +61 -60
- package/src/models/As2Station.js +58 -57
- package/src/models/Auto.js +5 -2
- package/src/models/Automation.js +121 -110
- package/src/models/AutomationRun.js +18 -17
- package/src/models/BandwidthSnapshot.js +10 -8
- package/src/models/Behavior.js +85 -86
- package/src/models/Bundle.js +121 -110
- package/src/models/BundleDownload.js +14 -12
- package/src/models/BundleNotification.js +40 -43
- package/src/models/BundleRecipient.js +33 -32
- package/src/models/BundleRegistration.js +12 -10
- package/src/models/Clickwrap.js +60 -58
- package/src/models/DnsRecord.js +10 -8
- package/src/models/EmailIncomingMessage.js +10 -8
- package/src/models/Errors.js +5 -2
- package/src/models/ExternalEvent.js +29 -29
- package/src/models/File.js +116 -108
- package/src/models/FileAction.js +5 -2
- package/src/models/FileComment.js +45 -46
- package/src/models/FileCommentReaction.js +26 -26
- package/src/models/FileMigration.js +10 -8
- package/src/models/FileUploadPart.js +5 -2
- package/src/models/Folder.js +32 -29
- package/src/models/FormField.js +5 -2
- package/src/models/FormFieldSet.js +49 -50
- package/src/models/GpgKey.js +60 -59
- package/src/models/Group.js +58 -57
- package/src/models/GroupUser.js +60 -58
- package/src/models/History.js +77 -74
- package/src/models/HistoryExport.js +62 -61
- package/src/models/HistoryExportResult.js +15 -13
- package/src/models/Image.js +5 -2
- package/src/models/InboxRecipient.js +33 -32
- package/src/models/InboxRegistration.js +12 -10
- package/src/models/InboxUpload.js +14 -12
- package/src/models/Invoice.js +17 -14
- package/src/models/InvoiceLineItem.js +5 -2
- package/src/models/IpAddress.js +22 -20
- package/src/models/Lock.js +36 -36
- package/src/models/Message.js +66 -66
- package/src/models/MessageComment.js +50 -52
- package/src/models/MessageCommentReaction.js +38 -40
- package/src/models/MessageReaction.js +38 -40
- package/src/models/Notification.js +74 -72
- package/src/models/Payment.js +17 -14
- package/src/models/PaymentLineItem.js +5 -2
- package/src/models/Permission.js +39 -40
- package/src/models/Preview.js +5 -2
- package/src/models/Priority.js +14 -12
- package/src/models/Project.js +43 -45
- package/src/models/PublicIpAddress.js +5 -2
- package/src/models/PublicKey.js +50 -52
- package/src/models/RemoteBandwidthSnapshot.js +10 -8
- package/src/models/RemoteServer.js +380 -312
- package/src/models/RemoteServerConfigurationFile.js +5 -2
- package/src/models/Request.js +44 -46
- package/src/models/Session.js +22 -22
- package/src/models/SettingsChange.js +10 -8
- package/src/models/SftpHostKey.js +45 -46
- package/src/models/ShareGroup.js +56 -56
- package/src/models/ShareGroupMember.js +5 -2
- package/src/models/Site.js +143 -142
- package/src/models/Snapshot.js +50 -50
- package/src/models/SsoStrategy.js +20 -21
- package/src/models/Status.js +5 -2
- package/src/models/Style.js +22 -23
- package/src/models/UsageDailySnapshot.js +10 -8
- package/src/models/UsageSnapshot.js +10 -8
- package/src/models/User.js +185 -168
- package/src/models/UserCipherUse.js +12 -10
- package/src/models/UserRequest.js +37 -39
- package/src/models/WebhookTest.js +26 -24
- package/test/Api.test.js +163 -0
- package/test/{package.json → integration/package.json} +1 -1
- package/test/{src → integration/src}/index.js +1 -1
- package/test.sh +2 -1
- /package/test/{.babelrc → integration/.babelrc} +0 -0
- /package/test/{index.js → integration/index.js} +0 -0
package/src/models/Automation.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
import Api from '../Api'
|
|
3
3
|
import * as errors from '../Errors'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getType, isArray, isInt, isObject, isString,
|
|
6
|
+
} from '../utils'
|
|
5
7
|
/* eslint-enable no-unused-vars */
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
|
|
|
9
11
|
*/
|
|
10
12
|
class Automation {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Automation {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Automation ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -199,7 +203,6 @@ class Automation {
|
|
|
199
203
|
this.attributes.destination = value
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
|
|
203
206
|
// Manually run automation
|
|
204
207
|
manualRun = async (params = {}) => {
|
|
205
208
|
if (!this.attributes.id) {
|
|
@@ -211,21 +214,19 @@ class Automation {
|
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
params.id = this.attributes.id
|
|
214
|
-
if (params
|
|
215
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
217
|
+
if (params.id && !isInt(params.id)) {
|
|
218
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
216
219
|
}
|
|
217
220
|
|
|
218
|
-
if (!params
|
|
221
|
+
if (!params.id) {
|
|
219
222
|
if (this.attributes.id) {
|
|
220
|
-
params
|
|
223
|
+
params.id = this.id
|
|
221
224
|
} else {
|
|
222
225
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return
|
|
229
|
+
await Api.sendRequest(`/automations/${encodeURIComponent(params.id)}/manual_run`, 'POST', params, this.options)
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
// Parameters:
|
|
@@ -259,69 +260,84 @@ class Automation {
|
|
|
259
260
|
}
|
|
260
261
|
|
|
261
262
|
params.id = this.attributes.id
|
|
262
|
-
if (params
|
|
263
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
263
|
+
if (params.id && !isInt(params.id)) {
|
|
264
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
264
265
|
}
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
|
|
267
|
+
if (params.source && !isString(params.source)) {
|
|
268
|
+
throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(params.source)}`)
|
|
267
269
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
+
|
|
271
|
+
if (params.destination && !isString(params.destination)) {
|
|
272
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(params.destination)}`)
|
|
270
273
|
}
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
|
|
275
|
+
if (params.destinations && !isArray(params.destinations)) {
|
|
276
|
+
throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(params.destinations)}`)
|
|
273
277
|
}
|
|
274
|
-
|
|
275
|
-
|
|
278
|
+
|
|
279
|
+
if (params.destination_replace_from && !isString(params.destination_replace_from)) {
|
|
280
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(params.destination_replace_from)}`)
|
|
276
281
|
}
|
|
277
|
-
|
|
278
|
-
|
|
282
|
+
|
|
283
|
+
if (params.destination_replace_to && !isString(params.destination_replace_to)) {
|
|
284
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(params.destination_replace_to)}`)
|
|
279
285
|
}
|
|
280
|
-
|
|
281
|
-
|
|
286
|
+
|
|
287
|
+
if (params.interval && !isString(params.interval)) {
|
|
288
|
+
throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(params.interval)}`)
|
|
282
289
|
}
|
|
283
|
-
|
|
284
|
-
|
|
290
|
+
|
|
291
|
+
if (params.path && !isString(params.path)) {
|
|
292
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
285
293
|
}
|
|
286
|
-
|
|
287
|
-
|
|
294
|
+
|
|
295
|
+
if (params.sync_ids && !isString(params.sync_ids)) {
|
|
296
|
+
throw new errors.InvalidParameterError(`Bad parameter: sync_ids must be of type String, received ${getType(params.sync_ids)}`)
|
|
288
297
|
}
|
|
289
|
-
|
|
290
|
-
|
|
298
|
+
|
|
299
|
+
if (params.user_ids && !isString(params.user_ids)) {
|
|
300
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(params.user_ids)}`)
|
|
291
301
|
}
|
|
292
|
-
|
|
293
|
-
|
|
302
|
+
|
|
303
|
+
if (params.group_ids && !isString(params.group_ids)) {
|
|
304
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params.group_ids)}`)
|
|
294
305
|
}
|
|
295
|
-
|
|
296
|
-
|
|
306
|
+
|
|
307
|
+
if (params.description && !isString(params.description)) {
|
|
308
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
|
297
309
|
}
|
|
298
|
-
|
|
299
|
-
|
|
310
|
+
|
|
311
|
+
if (params.name && !isString(params.name)) {
|
|
312
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
300
313
|
}
|
|
301
|
-
|
|
302
|
-
|
|
314
|
+
|
|
315
|
+
if (params.trigger && !isString(params.trigger)) {
|
|
316
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(params.trigger)}`)
|
|
303
317
|
}
|
|
304
|
-
|
|
305
|
-
|
|
318
|
+
|
|
319
|
+
if (params.trigger_actions && !isArray(params.trigger_actions)) {
|
|
320
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(params.trigger_actions)}`)
|
|
306
321
|
}
|
|
307
|
-
|
|
308
|
-
|
|
322
|
+
|
|
323
|
+
if (params.recurring_day && !isInt(params.recurring_day)) {
|
|
324
|
+
throw new errors.InvalidParameterError(`Bad parameter: recurring_day must be of type Int, received ${getType(params.recurring_day)}`)
|
|
309
325
|
}
|
|
310
|
-
|
|
311
|
-
|
|
326
|
+
|
|
327
|
+
if (params.automation && !isString(params.automation)) {
|
|
328
|
+
throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(params.automation)}`)
|
|
312
329
|
}
|
|
313
330
|
|
|
314
|
-
if (!params
|
|
331
|
+
if (!params.id) {
|
|
315
332
|
if (this.attributes.id) {
|
|
316
|
-
params
|
|
333
|
+
params.id = this.id
|
|
317
334
|
} else {
|
|
318
335
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
319
336
|
}
|
|
320
337
|
}
|
|
321
338
|
|
|
322
|
-
const response = await Api.sendRequest(`/automations/${encodeURIComponent(params
|
|
339
|
+
const response = await Api.sendRequest(`/automations/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
323
340
|
|
|
324
|
-
|
|
325
341
|
return new Automation(response?.data, this.options)
|
|
326
342
|
}
|
|
327
343
|
|
|
@@ -335,36 +351,34 @@ class Automation {
|
|
|
335
351
|
}
|
|
336
352
|
|
|
337
353
|
params.id = this.attributes.id
|
|
338
|
-
if (params
|
|
339
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
354
|
+
if (params.id && !isInt(params.id)) {
|
|
355
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
340
356
|
}
|
|
341
357
|
|
|
342
|
-
if (!params
|
|
358
|
+
if (!params.id) {
|
|
343
359
|
if (this.attributes.id) {
|
|
344
|
-
params
|
|
360
|
+
params.id = this.id
|
|
345
361
|
} else {
|
|
346
362
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
347
363
|
}
|
|
348
364
|
}
|
|
349
365
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return
|
|
366
|
+
await Api.sendRequest(`/automations/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
353
367
|
}
|
|
354
368
|
|
|
355
369
|
destroy = (params = {}) =>
|
|
356
370
|
this.delete(params)
|
|
357
371
|
|
|
358
372
|
save = async () => {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
373
|
+
if (this.attributes.id) {
|
|
374
|
+
const newObject = await this.update(this.attributes)
|
|
375
|
+
this.attributes = { ...newObject.attributes }
|
|
376
|
+
return true
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const newObject = await Automation.create(this.attributes, this.options)
|
|
380
|
+
this.attributes = { ...newObject.attributes }
|
|
381
|
+
return true
|
|
368
382
|
}
|
|
369
383
|
|
|
370
384
|
// Parameters:
|
|
@@ -378,17 +392,16 @@ class Automation {
|
|
|
378
392
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `last_modified_at`.
|
|
379
393
|
// with_deleted - boolean - Set to true to include deleted automations in the results.
|
|
380
394
|
static list = async (params = {}, options = {}) => {
|
|
381
|
-
if (params
|
|
382
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
395
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
396
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
383
397
|
}
|
|
384
398
|
|
|
385
|
-
if (params
|
|
386
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
399
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
400
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
387
401
|
}
|
|
388
402
|
|
|
389
|
-
const response = await Api.sendRequest(
|
|
403
|
+
const response = await Api.sendRequest('/automations', 'GET', params, options)
|
|
390
404
|
|
|
391
|
-
|
|
392
405
|
return response?.data?.map(obj => new Automation(obj, options)) || []
|
|
393
406
|
}
|
|
394
407
|
|
|
@@ -402,19 +415,18 @@ class Automation {
|
|
|
402
415
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
403
416
|
}
|
|
404
417
|
|
|
405
|
-
params
|
|
418
|
+
params.id = id
|
|
406
419
|
|
|
407
|
-
if (!params
|
|
420
|
+
if (!params.id) {
|
|
408
421
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
409
422
|
}
|
|
410
423
|
|
|
411
|
-
if (params
|
|
412
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
424
|
+
if (params.id && !isInt(params.id)) {
|
|
425
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
413
426
|
}
|
|
414
427
|
|
|
415
|
-
const response = await Api.sendRequest(`/automations/${encodeURIComponent(params
|
|
428
|
+
const response = await Api.sendRequest(`/automations/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
416
429
|
|
|
417
|
-
|
|
418
430
|
return new Automation(response?.data, options)
|
|
419
431
|
}
|
|
420
432
|
|
|
@@ -443,77 +455,76 @@ class Automation {
|
|
|
443
455
|
// recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
|
444
456
|
// automation (required) - string - Automation type
|
|
445
457
|
static create = async (params = {}, options = {}) => {
|
|
446
|
-
if (!params
|
|
458
|
+
if (!params.automation) {
|
|
447
459
|
throw new errors.MissingParameterError('Parameter missing: automation')
|
|
448
460
|
}
|
|
449
461
|
|
|
450
|
-
if (params
|
|
451
|
-
throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(params
|
|
462
|
+
if (params.source && !isString(params.source)) {
|
|
463
|
+
throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(params.source)}`)
|
|
452
464
|
}
|
|
453
465
|
|
|
454
|
-
if (params
|
|
455
|
-
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(params
|
|
466
|
+
if (params.destination && !isString(params.destination)) {
|
|
467
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(params.destination)}`)
|
|
456
468
|
}
|
|
457
469
|
|
|
458
|
-
if (params
|
|
459
|
-
throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(params
|
|
470
|
+
if (params.destinations && !isArray(params.destinations)) {
|
|
471
|
+
throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(params.destinations)}`)
|
|
460
472
|
}
|
|
461
473
|
|
|
462
|
-
if (params
|
|
463
|
-
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(params
|
|
474
|
+
if (params.destination_replace_from && !isString(params.destination_replace_from)) {
|
|
475
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(params.destination_replace_from)}`)
|
|
464
476
|
}
|
|
465
477
|
|
|
466
|
-
if (params
|
|
467
|
-
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(params
|
|
478
|
+
if (params.destination_replace_to && !isString(params.destination_replace_to)) {
|
|
479
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(params.destination_replace_to)}`)
|
|
468
480
|
}
|
|
469
481
|
|
|
470
|
-
if (params
|
|
471
|
-
throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(params
|
|
482
|
+
if (params.interval && !isString(params.interval)) {
|
|
483
|
+
throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(params.interval)}`)
|
|
472
484
|
}
|
|
473
485
|
|
|
474
|
-
if (params
|
|
475
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
486
|
+
if (params.path && !isString(params.path)) {
|
|
487
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
476
488
|
}
|
|
477
489
|
|
|
478
|
-
if (params
|
|
479
|
-
throw new errors.InvalidParameterError(`Bad parameter: sync_ids must be of type String, received ${getType(params
|
|
490
|
+
if (params.sync_ids && !isString(params.sync_ids)) {
|
|
491
|
+
throw new errors.InvalidParameterError(`Bad parameter: sync_ids must be of type String, received ${getType(params.sync_ids)}`)
|
|
480
492
|
}
|
|
481
493
|
|
|
482
|
-
if (params
|
|
483
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(params
|
|
494
|
+
if (params.user_ids && !isString(params.user_ids)) {
|
|
495
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(params.user_ids)}`)
|
|
484
496
|
}
|
|
485
497
|
|
|
486
|
-
if (params
|
|
487
|
-
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params
|
|
498
|
+
if (params.group_ids && !isString(params.group_ids)) {
|
|
499
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params.group_ids)}`)
|
|
488
500
|
}
|
|
489
501
|
|
|
490
|
-
if (params
|
|
491
|
-
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params
|
|
502
|
+
if (params.description && !isString(params.description)) {
|
|
503
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
|
492
504
|
}
|
|
493
505
|
|
|
494
|
-
if (params
|
|
495
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
|
506
|
+
if (params.name && !isString(params.name)) {
|
|
507
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
496
508
|
}
|
|
497
509
|
|
|
498
|
-
if (params
|
|
499
|
-
throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(params
|
|
510
|
+
if (params.trigger && !isString(params.trigger)) {
|
|
511
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(params.trigger)}`)
|
|
500
512
|
}
|
|
501
513
|
|
|
502
|
-
if (params
|
|
503
|
-
throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(params
|
|
514
|
+
if (params.trigger_actions && !isArray(params.trigger_actions)) {
|
|
515
|
+
throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(params.trigger_actions)}`)
|
|
504
516
|
}
|
|
505
517
|
|
|
506
|
-
if (params
|
|
507
|
-
throw new errors.InvalidParameterError(`Bad parameter: recurring_day must be of type Int, received ${getType(params
|
|
518
|
+
if (params.recurring_day && !isInt(params.recurring_day)) {
|
|
519
|
+
throw new errors.InvalidParameterError(`Bad parameter: recurring_day must be of type Int, received ${getType(params.recurring_day)}`)
|
|
508
520
|
}
|
|
509
521
|
|
|
510
|
-
if (params
|
|
511
|
-
throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(params
|
|
522
|
+
if (params.automation && !isString(params.automation)) {
|
|
523
|
+
throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(params.automation)}`)
|
|
512
524
|
}
|
|
513
525
|
|
|
514
|
-
const response = await Api.sendRequest(
|
|
526
|
+
const response = await Api.sendRequest('/automations', 'POST', params, options)
|
|
515
527
|
|
|
516
|
-
|
|
517
528
|
return new Automation(response?.data, options)
|
|
518
529
|
}
|
|
519
530
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
import Api from '../Api'
|
|
3
3
|
import * as errors from '../Errors'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getType, isArray, isInt, isObject, isString,
|
|
6
|
+
} from '../utils'
|
|
5
7
|
/* eslint-enable no-unused-vars */
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
|
|
|
9
11
|
*/
|
|
10
12
|
class AutomationRun {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class AutomationRun {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # ID.
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -42,7 +46,6 @@ class AutomationRun {
|
|
|
42
46
|
// string # Link to status messages log file.
|
|
43
47
|
getStatusMessagesUrl = () => this.attributes.status_messages_url
|
|
44
48
|
|
|
45
|
-
|
|
46
49
|
// Parameters:
|
|
47
50
|
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
48
51
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
@@ -50,25 +53,24 @@ class AutomationRun {
|
|
|
50
53
|
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `status` and `automation_id`. Valid field combinations are `[ automation_id, status ]`.
|
|
51
54
|
// automation_id (required) - int64 - ID of the associated Automation.
|
|
52
55
|
static list = async (params = {}, options = {}) => {
|
|
53
|
-
if (!params
|
|
56
|
+
if (!params.automation_id) {
|
|
54
57
|
throw new errors.MissingParameterError('Parameter missing: automation_id')
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
if (params
|
|
58
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
60
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
61
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
if (params
|
|
62
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
64
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
65
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
if (params
|
|
66
|
-
throw new errors.InvalidParameterError(`Bad parameter: automation_id must be of type Int, received ${getType(params
|
|
68
|
+
if (params.automation_id && !isInt(params.automation_id)) {
|
|
69
|
+
throw new errors.InvalidParameterError(`Bad parameter: automation_id must be of type Int, received ${getType(params.automation_id)}`)
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
const response = await Api.sendRequest(
|
|
72
|
+
const response = await Api.sendRequest('/automation_runs', 'GET', params, options)
|
|
70
73
|
|
|
71
|
-
|
|
72
74
|
return response?.data?.map(obj => new AutomationRun(obj, options)) || []
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -82,19 +84,18 @@ class AutomationRun {
|
|
|
82
84
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
params
|
|
87
|
+
params.id = id
|
|
86
88
|
|
|
87
|
-
if (!params
|
|
89
|
+
if (!params.id) {
|
|
88
90
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
if (params
|
|
92
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
93
|
+
if (params.id && !isInt(params.id)) {
|
|
94
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
const response = await Api.sendRequest(`/automation_runs/${encodeURIComponent(params
|
|
97
|
+
const response = await Api.sendRequest(`/automation_runs/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
96
98
|
|
|
97
|
-
|
|
98
99
|
return new AutomationRun(response?.data, options)
|
|
99
100
|
}
|
|
100
101
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
import Api from '../Api'
|
|
3
3
|
import * as errors from '../Errors'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getType, isArray, isInt, isObject, isString,
|
|
6
|
+
} from '../utils'
|
|
5
7
|
/* eslint-enable no-unused-vars */
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
|
|
|
9
11
|
*/
|
|
10
12
|
class BandwidthSnapshot {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class BandwidthSnapshot {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Site bandwidth ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -51,7 +55,6 @@ class BandwidthSnapshot {
|
|
|
51
55
|
// date-time # Time the site bandwidth report was logged
|
|
52
56
|
getLoggedAt = () => this.attributes.logged_at
|
|
53
57
|
|
|
54
|
-
|
|
55
58
|
// Parameters:
|
|
56
59
|
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
57
60
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
@@ -62,17 +65,16 @@ class BandwidthSnapshot {
|
|
|
62
65
|
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `logged_at`.
|
|
63
66
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `logged_at`.
|
|
64
67
|
static list = async (params = {}, options = {}) => {
|
|
65
|
-
if (params
|
|
66
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
68
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
69
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
if (params
|
|
70
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
72
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
73
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
const response = await Api.sendRequest(
|
|
76
|
+
const response = await Api.sendRequest('/bandwidth_snapshots', 'GET', params, options)
|
|
74
77
|
|
|
75
|
-
|
|
76
78
|
return response?.data?.map(obj => new BandwidthSnapshot(obj, options)) || []
|
|
77
79
|
}
|
|
78
80
|
|