files.com 1.1.19 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. package/.eslintrc.js +0 -3
  2. package/_VERSION +1 -1
  3. package/lib/Api.js +1 -1
  4. package/lib/Errors.js +345 -334
  5. package/lib/Files.js +1 -1
  6. package/lib/models/ActionNotificationExport.js +25 -25
  7. package/lib/models/ActionNotificationExportResult.js +10 -10
  8. package/lib/models/ActionWebhookFailure.js +5 -9
  9. package/lib/models/ApiKey.js +62 -70
  10. package/lib/models/App.js +5 -5
  11. package/lib/models/As2IncomingMessage.js +7 -7
  12. package/lib/models/As2OutgoingMessage.js +7 -7
  13. package/lib/models/As2Partner.js +54 -58
  14. package/lib/models/As2Station.js +51 -55
  15. package/lib/models/Automation.js +102 -110
  16. package/lib/models/AutomationRun.js +13 -13
  17. package/lib/models/BandwidthSnapshot.js +5 -5
  18. package/lib/models/Behavior.js +77 -85
  19. package/lib/models/Bundle.js +102 -110
  20. package/lib/models/BundleDownload.js +9 -9
  21. package/lib/models/BundleNotification.js +37 -41
  22. package/lib/models/BundleRecipient.js +22 -22
  23. package/lib/models/BundleRegistration.js +7 -7
  24. package/lib/models/Clickwrap.js +52 -56
  25. package/lib/models/DnsRecord.js +5 -5
  26. package/lib/models/EmailIncomingMessage.js +5 -5
  27. package/lib/models/ExternalEvent.js +18 -18
  28. package/lib/models/File.js +89 -93
  29. package/lib/models/FileComment.js +41 -45
  30. package/lib/models/FileCommentReaction.js +15 -19
  31. package/lib/models/FileMigration.js +5 -5
  32. package/lib/models/Folder.js +24 -24
  33. package/lib/models/FormFieldSet.js +44 -48
  34. package/lib/models/GpgKey.js +53 -57
  35. package/lib/models/Group.js +51 -55
  36. package/lib/models/GroupUser.js +53 -57
  37. package/lib/models/History.js +72 -72
  38. package/lib/models/HistoryExport.js +51 -51
  39. package/lib/models/HistoryExportResult.js +10 -10
  40. package/lib/models/InboxRecipient.js +22 -22
  41. package/lib/models/InboxRegistration.js +7 -7
  42. package/lib/models/InboxUpload.js +9 -9
  43. package/lib/models/Invoice.js +12 -12
  44. package/lib/models/IpAddress.js +17 -17
  45. package/lib/models/Lock.js +27 -31
  46. package/lib/models/Message.js +60 -64
  47. package/lib/models/MessageComment.js +46 -50
  48. package/lib/models/MessageCommentReaction.js +27 -31
  49. package/lib/models/MessageReaction.js +27 -31
  50. package/lib/models/Notification.js +66 -70
  51. package/lib/models/Payment.js +12 -12
  52. package/lib/models/Permission.js +28 -32
  53. package/lib/models/Priority.js +9 -9
  54. package/lib/models/Project.js +39 -43
  55. package/lib/models/PublicKey.js +46 -50
  56. package/lib/models/RemoteBandwidthSnapshot.js +5 -5
  57. package/lib/models/RemoteServer.js +306 -310
  58. package/lib/models/Request.js +33 -37
  59. package/lib/models/Session.js +11 -15
  60. package/lib/models/SettingsChange.js +5 -5
  61. package/lib/models/SftpHostKey.js +40 -44
  62. package/lib/models/ShareGroup.js +50 -54
  63. package/lib/models/Site.js +138 -138
  64. package/lib/models/Snapshot.js +44 -48
  65. package/lib/models/SsoStrategy.js +15 -19
  66. package/lib/models/Style.js +17 -21
  67. package/lib/models/UsageDailySnapshot.js +5 -5
  68. package/lib/models/UsageSnapshot.js +5 -5
  69. package/lib/models/User.js +156 -172
  70. package/lib/models/UserCipherUse.js +7 -7
  71. package/lib/models/UserRequest.js +26 -30
  72. package/lib/models/WebhookTest.js +15 -15
  73. package/package.json +6 -2
  74. package/src/Api.js +2 -1
  75. package/src/Errors.js +189 -178
  76. package/src/Files.js +1 -1
  77. package/src/models/AccountLineItem.js +5 -2
  78. package/src/models/Action.js +5 -2
  79. package/src/models/ActionNotificationExport.js +36 -35
  80. package/src/models/ActionNotificationExportResult.js +15 -13
  81. package/src/models/ActionWebhookFailure.js +9 -8
  82. package/src/models/ApiKey.js +69 -72
  83. package/src/models/App.js +10 -8
  84. package/src/models/As2IncomingMessage.js +12 -10
  85. package/src/models/As2OutgoingMessage.js +12 -10
  86. package/src/models/As2Partner.js +61 -60
  87. package/src/models/As2Station.js +58 -57
  88. package/src/models/Auto.js +5 -2
  89. package/src/models/Automation.js +121 -110
  90. package/src/models/AutomationRun.js +18 -17
  91. package/src/models/BandwidthSnapshot.js +10 -8
  92. package/src/models/Behavior.js +85 -86
  93. package/src/models/Bundle.js +121 -110
  94. package/src/models/BundleDownload.js +14 -12
  95. package/src/models/BundleNotification.js +40 -43
  96. package/src/models/BundleRecipient.js +33 -32
  97. package/src/models/BundleRegistration.js +12 -10
  98. package/src/models/Clickwrap.js +60 -58
  99. package/src/models/DnsRecord.js +10 -8
  100. package/src/models/EmailIncomingMessage.js +10 -8
  101. package/src/models/Errors.js +5 -2
  102. package/src/models/ExternalEvent.js +29 -29
  103. package/src/models/File.js +116 -108
  104. package/src/models/FileAction.js +5 -2
  105. package/src/models/FileComment.js +45 -46
  106. package/src/models/FileCommentReaction.js +26 -26
  107. package/src/models/FileMigration.js +10 -8
  108. package/src/models/FileUploadPart.js +5 -2
  109. package/src/models/Folder.js +32 -29
  110. package/src/models/FormField.js +5 -2
  111. package/src/models/FormFieldSet.js +49 -50
  112. package/src/models/GpgKey.js +60 -59
  113. package/src/models/Group.js +58 -57
  114. package/src/models/GroupUser.js +60 -58
  115. package/src/models/History.js +77 -74
  116. package/src/models/HistoryExport.js +62 -61
  117. package/src/models/HistoryExportResult.js +15 -13
  118. package/src/models/Image.js +5 -2
  119. package/src/models/InboxRecipient.js +33 -32
  120. package/src/models/InboxRegistration.js +12 -10
  121. package/src/models/InboxUpload.js +14 -12
  122. package/src/models/Invoice.js +17 -14
  123. package/src/models/InvoiceLineItem.js +5 -2
  124. package/src/models/IpAddress.js +22 -20
  125. package/src/models/Lock.js +36 -36
  126. package/src/models/Message.js +66 -66
  127. package/src/models/MessageComment.js +50 -52
  128. package/src/models/MessageCommentReaction.js +38 -40
  129. package/src/models/MessageReaction.js +38 -40
  130. package/src/models/Notification.js +74 -72
  131. package/src/models/Payment.js +17 -14
  132. package/src/models/PaymentLineItem.js +5 -2
  133. package/src/models/Permission.js +39 -40
  134. package/src/models/Preview.js +5 -2
  135. package/src/models/Priority.js +14 -12
  136. package/src/models/Project.js +43 -45
  137. package/src/models/PublicIpAddress.js +5 -2
  138. package/src/models/PublicKey.js +50 -52
  139. package/src/models/RemoteBandwidthSnapshot.js +10 -8
  140. package/src/models/RemoteServer.js +380 -312
  141. package/src/models/RemoteServerConfigurationFile.js +5 -2
  142. package/src/models/Request.js +44 -46
  143. package/src/models/Session.js +22 -22
  144. package/src/models/SettingsChange.js +10 -8
  145. package/src/models/SftpHostKey.js +45 -46
  146. package/src/models/ShareGroup.js +56 -56
  147. package/src/models/ShareGroupMember.js +5 -2
  148. package/src/models/Site.js +143 -142
  149. package/src/models/Snapshot.js +50 -50
  150. package/src/models/SsoStrategy.js +20 -21
  151. package/src/models/Status.js +5 -2
  152. package/src/models/Style.js +22 -23
  153. package/src/models/UsageDailySnapshot.js +10 -8
  154. package/src/models/UsageSnapshot.js +10 -8
  155. package/src/models/User.js +185 -168
  156. package/src/models/UserCipherUse.js +12 -10
  157. package/src/models/UserRequest.js +37 -39
  158. package/src/models/WebhookTest.js +26 -24
  159. package/test/Api.test.js +163 -0
  160. package/test/{package.json → integration/package.json} +1 -1
  161. package/test/{src → integration/src}/index.js +1 -1
  162. package/test.sh +2 -1
  163. /package/test/{.babelrc → integration/.babelrc} +0 -0
  164. /package/test/{index.js → integration/index.js} +0 -0
@@ -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 { getType, isArray, isInt, isObject, isString } from '../utils'
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['id'] && !isInt(params['id'])) {
215
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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['id']) {
221
+ if (!params.id) {
219
222
  if (this.attributes.id) {
220
- params['id'] = this.id
223
+ params.id = this.id
221
224
  } else {
222
225
  throw new errors.MissingParameterError('Parameter missing: id')
223
226
  }
224
227
  }
225
228
 
226
- const response = await Api.sendRequest(`/automations/${encodeURIComponent(params['id'])}/manual_run`, 'POST', params, this.options)
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['id'] && !isInt(params['id'])) {
263
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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
- if (params['source'] && !isString(params['source'])) {
266
- throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(params['source'])}`)
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
- if (params['destination'] && !isString(params['destination'])) {
269
- throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(params['destination'])}`)
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
- if (params['destinations'] && !isArray(params['destinations'])) {
272
- throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(params['destinations'])}`)
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
- if (params['destination_replace_from'] && !isString(params['destination_replace_from'])) {
275
- throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(params['destination_replace_from'])}`)
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
- if (params['destination_replace_to'] && !isString(params['destination_replace_to'])) {
278
- throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(params['destination_replace_to'])}`)
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
- if (params['interval'] && !isString(params['interval'])) {
281
- throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(params['interval'])}`)
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
- if (params['path'] && !isString(params['path'])) {
284
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
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
- if (params['sync_ids'] && !isString(params['sync_ids'])) {
287
- throw new errors.InvalidParameterError(`Bad parameter: sync_ids must be of type String, received ${getType(params['sync_ids'])}`)
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
- if (params['user_ids'] && !isString(params['user_ids'])) {
290
- throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(params['user_ids'])}`)
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
- if (params['group_ids'] && !isString(params['group_ids'])) {
293
- throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params['group_ids'])}`)
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
- if (params['description'] && !isString(params['description'])) {
296
- throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params['description'])}`)
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
- if (params['name'] && !isString(params['name'])) {
299
- throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
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
- if (params['trigger'] && !isString(params['trigger'])) {
302
- throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(params['trigger'])}`)
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
- if (params['trigger_actions'] && !isArray(params['trigger_actions'])) {
305
- throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(params['trigger_actions'])}`)
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
- if (params['recurring_day'] && !isInt(params['recurring_day'])) {
308
- throw new errors.InvalidParameterError(`Bad parameter: recurring_day must be of type Int, received ${getType(params['recurring_day'])}`)
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
- if (params['automation'] && !isString(params['automation'])) {
311
- throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(params['automation'])}`)
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['id']) {
331
+ if (!params.id) {
315
332
  if (this.attributes.id) {
316
- params['id'] = this.id
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['id'])}`, 'PATCH', params, this.options)
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['id'] && !isInt(params['id'])) {
339
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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['id']) {
358
+ if (!params.id) {
343
359
  if (this.attributes.id) {
344
- params['id'] = this.id
360
+ params.id = this.id
345
361
  } else {
346
362
  throw new errors.MissingParameterError('Parameter missing: id')
347
363
  }
348
364
  }
349
365
 
350
- const response = await Api.sendRequest(`/automations/${encodeURIComponent(params['id'])}`, 'DELETE', params, this.options)
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
- if (this.attributes['id']) {
360
- const newObject = await this.update(this.attributes)
361
- this.attributes = { ...newObject.attributes }
362
- return true
363
- } else {
364
- const newObject = await Automation.create(this.attributes, this.options)
365
- this.attributes = { ...newObject.attributes }
366
- return true
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['cursor'] && !isString(params['cursor'])) {
382
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
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['per_page'] && !isInt(params['per_page'])) {
386
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
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(`/automations`, 'GET', params, options)
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['id'] = id
418
+ params.id = id
406
419
 
407
- if (!params['id']) {
420
+ if (!params.id) {
408
421
  throw new errors.MissingParameterError('Parameter missing: id')
409
422
  }
410
423
 
411
- if (params['id'] && !isInt(params['id'])) {
412
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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['id'])}`, 'GET', params, options)
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['automation']) {
458
+ if (!params.automation) {
447
459
  throw new errors.MissingParameterError('Parameter missing: automation')
448
460
  }
449
461
 
450
- if (params['source'] && !isString(params['source'])) {
451
- throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(params['source'])}`)
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['destination'] && !isString(params['destination'])) {
455
- throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(params['destination'])}`)
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['destinations'] && !isArray(params['destinations'])) {
459
- throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(params['destinations'])}`)
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['destination_replace_from'] && !isString(params['destination_replace_from'])) {
463
- throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(params['destination_replace_from'])}`)
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['destination_replace_to'] && !isString(params['destination_replace_to'])) {
467
- throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(params['destination_replace_to'])}`)
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['interval'] && !isString(params['interval'])) {
471
- throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(params['interval'])}`)
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['path'] && !isString(params['path'])) {
475
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
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['sync_ids'] && !isString(params['sync_ids'])) {
479
- throw new errors.InvalidParameterError(`Bad parameter: sync_ids must be of type String, received ${getType(params['sync_ids'])}`)
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['user_ids'] && !isString(params['user_ids'])) {
483
- throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(params['user_ids'])}`)
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['group_ids'] && !isString(params['group_ids'])) {
487
- throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params['group_ids'])}`)
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['description'] && !isString(params['description'])) {
491
- throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params['description'])}`)
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['name'] && !isString(params['name'])) {
495
- throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
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['trigger'] && !isString(params['trigger'])) {
499
- throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(params['trigger'])}`)
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['trigger_actions'] && !isArray(params['trigger_actions'])) {
503
- throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(params['trigger_actions'])}`)
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['recurring_day'] && !isInt(params['recurring_day'])) {
507
- throw new errors.InvalidParameterError(`Bad parameter: recurring_day must be of type Int, received ${getType(params['recurring_day'])}`)
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['automation'] && !isString(params['automation'])) {
511
- throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(params['automation'])}`)
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(`/automations`, 'POST', params, options)
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 { getType, isArray, isInt, isObject, isString } from '../utils'
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['automation_id']) {
56
+ if (!params.automation_id) {
54
57
  throw new errors.MissingParameterError('Parameter missing: automation_id')
55
58
  }
56
59
 
57
- if (params['cursor'] && !isString(params['cursor'])) {
58
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
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['per_page'] && !isInt(params['per_page'])) {
62
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
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['automation_id'] && !isInt(params['automation_id'])) {
66
- throw new errors.InvalidParameterError(`Bad parameter: automation_id must be of type Int, received ${getType(params['automation_id'])}`)
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(`/automation_runs`, 'GET', params, options)
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['id'] = id
87
+ params.id = id
86
88
 
87
- if (!params['id']) {
89
+ if (!params.id) {
88
90
  throw new errors.MissingParameterError('Parameter missing: id')
89
91
  }
90
92
 
91
- if (params['id'] && !isInt(params['id'])) {
92
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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['id'])}`, 'GET', params, options)
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 { getType, isArray, isInt, isObject, isString } from '../utils'
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['cursor'] && !isString(params['cursor'])) {
66
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
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['per_page'] && !isInt(params['per_page'])) {
70
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
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(`/bandwidth_snapshots`, 'GET', params, options)
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