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.
Files changed (165) hide show
  1. package/.eslintrc.js +0 -3
  2. package/_VERSION +1 -1
  3. package/docs/Errors.md +1 -0
  4. package/lib/Api.js +1 -1
  5. package/lib/Errors.js +957 -933
  6. package/lib/Files.js +1 -1
  7. package/lib/models/ActionNotificationExport.js +25 -25
  8. package/lib/models/ActionNotificationExportResult.js +10 -10
  9. package/lib/models/ActionWebhookFailure.js +5 -9
  10. package/lib/models/ApiKey.js +62 -70
  11. package/lib/models/App.js +5 -5
  12. package/lib/models/As2IncomingMessage.js +7 -7
  13. package/lib/models/As2OutgoingMessage.js +7 -7
  14. package/lib/models/As2Partner.js +54 -58
  15. package/lib/models/As2Station.js +51 -55
  16. package/lib/models/Automation.js +102 -110
  17. package/lib/models/AutomationRun.js +13 -13
  18. package/lib/models/BandwidthSnapshot.js +5 -5
  19. package/lib/models/Behavior.js +77 -85
  20. package/lib/models/Bundle.js +102 -110
  21. package/lib/models/BundleDownload.js +9 -9
  22. package/lib/models/BundleNotification.js +37 -41
  23. package/lib/models/BundleRecipient.js +22 -22
  24. package/lib/models/BundleRegistration.js +7 -7
  25. package/lib/models/Clickwrap.js +52 -56
  26. package/lib/models/DnsRecord.js +5 -5
  27. package/lib/models/EmailIncomingMessage.js +5 -5
  28. package/lib/models/ExternalEvent.js +18 -18
  29. package/lib/models/File.js +89 -93
  30. package/lib/models/FileComment.js +41 -45
  31. package/lib/models/FileCommentReaction.js +15 -19
  32. package/lib/models/FileMigration.js +5 -5
  33. package/lib/models/Folder.js +24 -24
  34. package/lib/models/FormFieldSet.js +44 -48
  35. package/lib/models/GpgKey.js +53 -57
  36. package/lib/models/Group.js +51 -55
  37. package/lib/models/GroupUser.js +53 -57
  38. package/lib/models/History.js +72 -72
  39. package/lib/models/HistoryExport.js +51 -51
  40. package/lib/models/HistoryExportResult.js +10 -10
  41. package/lib/models/InboxRecipient.js +22 -22
  42. package/lib/models/InboxRegistration.js +7 -7
  43. package/lib/models/InboxUpload.js +9 -9
  44. package/lib/models/Invoice.js +12 -12
  45. package/lib/models/IpAddress.js +17 -17
  46. package/lib/models/Lock.js +27 -31
  47. package/lib/models/Message.js +60 -64
  48. package/lib/models/MessageComment.js +46 -50
  49. package/lib/models/MessageCommentReaction.js +27 -31
  50. package/lib/models/MessageReaction.js +27 -31
  51. package/lib/models/Notification.js +66 -70
  52. package/lib/models/Payment.js +12 -12
  53. package/lib/models/Permission.js +28 -32
  54. package/lib/models/Priority.js +9 -9
  55. package/lib/models/Project.js +39 -43
  56. package/lib/models/PublicKey.js +46 -50
  57. package/lib/models/RemoteBandwidthSnapshot.js +5 -5
  58. package/lib/models/RemoteServer.js +306 -310
  59. package/lib/models/Request.js +33 -37
  60. package/lib/models/Session.js +11 -15
  61. package/lib/models/SettingsChange.js +5 -5
  62. package/lib/models/SftpHostKey.js +40 -44
  63. package/lib/models/ShareGroup.js +50 -54
  64. package/lib/models/Site.js +138 -138
  65. package/lib/models/Snapshot.js +44 -48
  66. package/lib/models/SsoStrategy.js +15 -19
  67. package/lib/models/Style.js +17 -21
  68. package/lib/models/UsageDailySnapshot.js +5 -5
  69. package/lib/models/UsageSnapshot.js +5 -5
  70. package/lib/models/User.js +156 -172
  71. package/lib/models/UserCipherUse.js +7 -7
  72. package/lib/models/UserRequest.js +26 -30
  73. package/lib/models/WebhookTest.js +15 -15
  74. package/package.json +6 -2
  75. package/src/Api.js +2 -1
  76. package/src/Errors.js +189 -177
  77. package/src/Files.js +1 -1
  78. package/src/models/AccountLineItem.js +5 -2
  79. package/src/models/Action.js +5 -2
  80. package/src/models/ActionNotificationExport.js +36 -35
  81. package/src/models/ActionNotificationExportResult.js +15 -13
  82. package/src/models/ActionWebhookFailure.js +9 -8
  83. package/src/models/ApiKey.js +69 -72
  84. package/src/models/App.js +10 -8
  85. package/src/models/As2IncomingMessage.js +12 -10
  86. package/src/models/As2OutgoingMessage.js +12 -10
  87. package/src/models/As2Partner.js +61 -60
  88. package/src/models/As2Station.js +58 -57
  89. package/src/models/Auto.js +5 -2
  90. package/src/models/Automation.js +121 -110
  91. package/src/models/AutomationRun.js +18 -17
  92. package/src/models/BandwidthSnapshot.js +10 -8
  93. package/src/models/Behavior.js +85 -86
  94. package/src/models/Bundle.js +121 -110
  95. package/src/models/BundleDownload.js +14 -12
  96. package/src/models/BundleNotification.js +40 -43
  97. package/src/models/BundleRecipient.js +33 -32
  98. package/src/models/BundleRegistration.js +12 -10
  99. package/src/models/Clickwrap.js +60 -58
  100. package/src/models/DnsRecord.js +10 -8
  101. package/src/models/EmailIncomingMessage.js +10 -8
  102. package/src/models/Errors.js +5 -2
  103. package/src/models/ExternalEvent.js +29 -29
  104. package/src/models/File.js +116 -108
  105. package/src/models/FileAction.js +5 -2
  106. package/src/models/FileComment.js +45 -46
  107. package/src/models/FileCommentReaction.js +26 -26
  108. package/src/models/FileMigration.js +10 -8
  109. package/src/models/FileUploadPart.js +5 -2
  110. package/src/models/Folder.js +32 -29
  111. package/src/models/FormField.js +5 -2
  112. package/src/models/FormFieldSet.js +49 -50
  113. package/src/models/GpgKey.js +60 -59
  114. package/src/models/Group.js +58 -57
  115. package/src/models/GroupUser.js +60 -58
  116. package/src/models/History.js +77 -74
  117. package/src/models/HistoryExport.js +62 -61
  118. package/src/models/HistoryExportResult.js +15 -13
  119. package/src/models/Image.js +5 -2
  120. package/src/models/InboxRecipient.js +33 -32
  121. package/src/models/InboxRegistration.js +12 -10
  122. package/src/models/InboxUpload.js +14 -12
  123. package/src/models/Invoice.js +17 -14
  124. package/src/models/InvoiceLineItem.js +5 -2
  125. package/src/models/IpAddress.js +22 -20
  126. package/src/models/Lock.js +36 -36
  127. package/src/models/Message.js +66 -66
  128. package/src/models/MessageComment.js +50 -52
  129. package/src/models/MessageCommentReaction.js +38 -40
  130. package/src/models/MessageReaction.js +38 -40
  131. package/src/models/Notification.js +74 -72
  132. package/src/models/Payment.js +17 -14
  133. package/src/models/PaymentLineItem.js +5 -2
  134. package/src/models/Permission.js +39 -40
  135. package/src/models/Preview.js +5 -2
  136. package/src/models/Priority.js +14 -12
  137. package/src/models/Project.js +43 -45
  138. package/src/models/PublicIpAddress.js +5 -2
  139. package/src/models/PublicKey.js +50 -52
  140. package/src/models/RemoteBandwidthSnapshot.js +10 -8
  141. package/src/models/RemoteServer.js +380 -312
  142. package/src/models/RemoteServerConfigurationFile.js +5 -2
  143. package/src/models/Request.js +44 -46
  144. package/src/models/Session.js +22 -22
  145. package/src/models/SettingsChange.js +10 -8
  146. package/src/models/SftpHostKey.js +45 -46
  147. package/src/models/ShareGroup.js +56 -56
  148. package/src/models/ShareGroupMember.js +5 -2
  149. package/src/models/Site.js +143 -142
  150. package/src/models/Snapshot.js +50 -50
  151. package/src/models/SsoStrategy.js +20 -21
  152. package/src/models/Status.js +5 -2
  153. package/src/models/Style.js +22 -23
  154. package/src/models/UsageDailySnapshot.js +10 -8
  155. package/src/models/UsageSnapshot.js +10 -8
  156. package/src/models/User.js +185 -168
  157. package/src/models/UserCipherUse.js +12 -10
  158. package/src/models/UserRequest.js +37 -39
  159. package/src/models/WebhookTest.js +26 -24
  160. package/test/Api.test.js +163 -0
  161. package/test/{package.json → integration/package.json} +1 -1
  162. package/test/{src → integration/src}/index.js +1 -1
  163. package/test.sh +2 -1
  164. /package/test/{.babelrc → integration/.babelrc} +0 -0
  165. /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 Bundle {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class Bundle {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // string # Bundle code. This code forms the end part of the Public URL.
28
32
  getCode = () => this.attributes.code
29
33
 
@@ -321,7 +325,6 @@ class Bundle {
321
325
  this.attributes.watermark_attachment_delete = value
322
326
  }
323
327
 
324
-
325
328
  // Send email(s) with a link to bundle
326
329
  //
327
330
  // Parameters:
@@ -338,30 +341,31 @@ class Bundle {
338
341
  }
339
342
 
340
343
  params.id = this.attributes.id
341
- if (params['id'] && !isInt(params['id'])) {
342
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
344
+ if (params.id && !isInt(params.id)) {
345
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
343
346
  }
344
- if (params['to'] && !isArray(params['to'])) {
345
- throw new errors.InvalidParameterError(`Bad parameter: to must be of type Array, received ${getType(params['to'])}`)
347
+
348
+ if (params.to && !isArray(params.to)) {
349
+ throw new errors.InvalidParameterError(`Bad parameter: to must be of type Array, received ${getType(params.to)}`)
346
350
  }
347
- if (params['note'] && !isString(params['note'])) {
348
- throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params['note'])}`)
351
+
352
+ if (params.note && !isString(params.note)) {
353
+ throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
349
354
  }
350
- if (params['recipients'] && !isArray(params['recipients'])) {
351
- throw new errors.InvalidParameterError(`Bad parameter: recipients must be of type Array, received ${getType(params['recipients'])}`)
355
+
356
+ if (params.recipients && !isArray(params.recipients)) {
357
+ throw new errors.InvalidParameterError(`Bad parameter: recipients must be of type Array, received ${getType(params.recipients)}`)
352
358
  }
353
359
 
354
- if (!params['id']) {
360
+ if (!params.id) {
355
361
  if (this.attributes.id) {
356
- params['id'] = this.id
362
+ params.id = this.id
357
363
  } else {
358
364
  throw new errors.MissingParameterError('Parameter missing: id')
359
365
  }
360
366
  }
361
367
 
362
- const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params['id'])}/share`, 'POST', params, this.options)
363
-
364
- return
368
+ await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}/share`, 'POST', params, this.options)
365
369
  }
366
370
 
367
371
  // Parameters:
@@ -400,60 +404,72 @@ class Bundle {
400
404
  }
401
405
 
402
406
  params.id = this.attributes.id
403
- if (params['id'] && !isInt(params['id'])) {
404
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
407
+ if (params.id && !isInt(params.id)) {
408
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
405
409
  }
406
- if (params['paths'] && !isArray(params['paths'])) {
407
- throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params['paths'])}`)
410
+
411
+ if (params.paths && !isArray(params.paths)) {
412
+ throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
408
413
  }
409
- if (params['password'] && !isString(params['password'])) {
410
- throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params['password'])}`)
414
+
415
+ if (params.password && !isString(params.password)) {
416
+ throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params.password)}`)
411
417
  }
412
- if (params['form_field_set_id'] && !isInt(params['form_field_set_id'])) {
413
- throw new errors.InvalidParameterError(`Bad parameter: form_field_set_id must be of type Int, received ${getType(params['form_field_set_id'])}`)
418
+
419
+ if (params.form_field_set_id && !isInt(params.form_field_set_id)) {
420
+ throw new errors.InvalidParameterError(`Bad parameter: form_field_set_id must be of type Int, received ${getType(params.form_field_set_id)}`)
414
421
  }
415
- if (params['clickwrap_id'] && !isInt(params['clickwrap_id'])) {
416
- throw new errors.InvalidParameterError(`Bad parameter: clickwrap_id must be of type Int, received ${getType(params['clickwrap_id'])}`)
422
+
423
+ if (params.clickwrap_id && !isInt(params.clickwrap_id)) {
424
+ throw new errors.InvalidParameterError(`Bad parameter: clickwrap_id must be of type Int, received ${getType(params.clickwrap_id)}`)
417
425
  }
418
- if (params['code'] && !isString(params['code'])) {
419
- throw new errors.InvalidParameterError(`Bad parameter: code must be of type String, received ${getType(params['code'])}`)
426
+
427
+ if (params.code && !isString(params.code)) {
428
+ throw new errors.InvalidParameterError(`Bad parameter: code must be of type String, received ${getType(params.code)}`)
420
429
  }
421
- if (params['description'] && !isString(params['description'])) {
422
- throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params['description'])}`)
430
+
431
+ if (params.description && !isString(params.description)) {
432
+ throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
423
433
  }
424
- if (params['expires_at'] && !isString(params['expires_at'])) {
425
- throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
434
+
435
+ if (params.expires_at && !isString(params.expires_at)) {
436
+ throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
426
437
  }
427
- if (params['inbox_id'] && !isInt(params['inbox_id'])) {
428
- throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
438
+
439
+ if (params.inbox_id && !isInt(params.inbox_id)) {
440
+ throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
429
441
  }
430
- if (params['max_uses'] && !isInt(params['max_uses'])) {
431
- throw new errors.InvalidParameterError(`Bad parameter: max_uses must be of type Int, received ${getType(params['max_uses'])}`)
442
+
443
+ if (params.max_uses && !isInt(params.max_uses)) {
444
+ throw new errors.InvalidParameterError(`Bad parameter: max_uses must be of type Int, received ${getType(params.max_uses)}`)
432
445
  }
433
- if (params['note'] && !isString(params['note'])) {
434
- throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params['note'])}`)
446
+
447
+ if (params.note && !isString(params.note)) {
448
+ throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
435
449
  }
436
- if (params['path_template'] && !isString(params['path_template'])) {
437
- throw new errors.InvalidParameterError(`Bad parameter: path_template must be of type String, received ${getType(params['path_template'])}`)
450
+
451
+ if (params.path_template && !isString(params.path_template)) {
452
+ throw new errors.InvalidParameterError(`Bad parameter: path_template must be of type String, received ${getType(params.path_template)}`)
438
453
  }
439
- if (params['permissions'] && !isString(params['permissions'])) {
440
- throw new errors.InvalidParameterError(`Bad parameter: permissions must be of type String, received ${getType(params['permissions'])}`)
454
+
455
+ if (params.permissions && !isString(params.permissions)) {
456
+ throw new errors.InvalidParameterError(`Bad parameter: permissions must be of type String, received ${getType(params.permissions)}`)
441
457
  }
442
- if (params['start_access_on_date'] && !isString(params['start_access_on_date'])) {
443
- throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params['start_access_on_date'])}`)
458
+
459
+ if (params.start_access_on_date && !isString(params.start_access_on_date)) {
460
+ throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params.start_access_on_date)}`)
444
461
  }
445
462
 
446
- if (!params['id']) {
463
+ if (!params.id) {
447
464
  if (this.attributes.id) {
448
- params['id'] = this.id
465
+ params.id = this.id
449
466
  } else {
450
467
  throw new errors.MissingParameterError('Parameter missing: id')
451
468
  }
452
469
  }
453
470
 
454
- const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params['id'])}`, 'PATCH', params, this.options)
471
+ const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
455
472
 
456
-
457
473
  return new Bundle(response?.data, this.options)
458
474
  }
459
475
 
@@ -467,36 +483,34 @@ class Bundle {
467
483
  }
468
484
 
469
485
  params.id = this.attributes.id
470
- if (params['id'] && !isInt(params['id'])) {
471
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
486
+ if (params.id && !isInt(params.id)) {
487
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
472
488
  }
473
489
 
474
- if (!params['id']) {
490
+ if (!params.id) {
475
491
  if (this.attributes.id) {
476
- params['id'] = this.id
492
+ params.id = this.id
477
493
  } else {
478
494
  throw new errors.MissingParameterError('Parameter missing: id')
479
495
  }
480
496
  }
481
497
 
482
- const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params['id'])}`, 'DELETE', params, this.options)
483
-
484
- return
498
+ await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
485
499
  }
486
500
 
487
501
  destroy = (params = {}) =>
488
502
  this.delete(params)
489
503
 
490
504
  save = async () => {
491
- if (this.attributes['id']) {
492
- const newObject = await this.update(this.attributes)
493
- this.attributes = { ...newObject.attributes }
494
- return true
495
- } else {
496
- const newObject = await Bundle.create(this.attributes, this.options)
497
- this.attributes = { ...newObject.attributes }
498
- return true
499
- }
505
+ if (this.attributes.id) {
506
+ const newObject = await this.update(this.attributes)
507
+ this.attributes = { ...newObject.attributes }
508
+ return true
509
+ }
510
+
511
+ const newObject = await Bundle.create(this.attributes, this.options)
512
+ this.attributes = { ...newObject.attributes }
513
+ return true
500
514
  }
501
515
 
502
516
  // Parameters:
@@ -510,21 +524,20 @@ class Bundle {
510
524
  // filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
511
525
  // filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
512
526
  static list = async (params = {}, options = {}) => {
513
- if (params['user_id'] && !isInt(params['user_id'])) {
514
- throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params['user_id'])}`)
527
+ if (params.user_id && !isInt(params.user_id)) {
528
+ throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
515
529
  }
516
530
 
517
- if (params['cursor'] && !isString(params['cursor'])) {
518
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
531
+ if (params.cursor && !isString(params.cursor)) {
532
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
519
533
  }
520
534
 
521
- if (params['per_page'] && !isInt(params['per_page'])) {
522
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
535
+ if (params.per_page && !isInt(params.per_page)) {
536
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
523
537
  }
524
538
 
525
- const response = await Api.sendRequest(`/bundles`, 'GET', params, options)
539
+ const response = await Api.sendRequest('/bundles', 'GET', params, options)
526
540
 
527
-
528
541
  return response?.data?.map(obj => new Bundle(obj, options)) || []
529
542
  }
530
543
 
@@ -538,19 +551,18 @@ class Bundle {
538
551
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
539
552
  }
540
553
 
541
- params['id'] = id
554
+ params.id = id
542
555
 
543
- if (!params['id']) {
556
+ if (!params.id) {
544
557
  throw new errors.MissingParameterError('Parameter missing: id')
545
558
  }
546
559
 
547
- if (params['id'] && !isInt(params['id'])) {
548
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
560
+ if (params.id && !isInt(params.id)) {
561
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
549
562
  }
550
563
 
551
- const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params['id'])}`, 'GET', params, options)
564
+ const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}`, 'GET', params, options)
552
565
 
553
-
554
566
  return new Bundle(response?.data, options)
555
567
  }
556
568
 
@@ -585,73 +597,72 @@ class Bundle {
585
597
  // snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
586
598
  // watermark_attachment_file - file - Preview watermark image applied to all bundle items.
587
599
  static create = async (params = {}, options = {}) => {
588
- if (!params['paths']) {
600
+ if (!params.paths) {
589
601
  throw new errors.MissingParameterError('Parameter missing: paths')
590
602
  }
591
603
 
592
- if (params['user_id'] && !isInt(params['user_id'])) {
593
- throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params['user_id'])}`)
604
+ if (params.user_id && !isInt(params.user_id)) {
605
+ throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
594
606
  }
595
607
 
596
- if (params['paths'] && !isArray(params['paths'])) {
597
- throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params['paths'])}`)
608
+ if (params.paths && !isArray(params.paths)) {
609
+ throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
598
610
  }
599
611
 
600
- if (params['password'] && !isString(params['password'])) {
601
- throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params['password'])}`)
612
+ if (params.password && !isString(params.password)) {
613
+ throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params.password)}`)
602
614
  }
603
615
 
604
- if (params['form_field_set_id'] && !isInt(params['form_field_set_id'])) {
605
- throw new errors.InvalidParameterError(`Bad parameter: form_field_set_id must be of type Int, received ${getType(params['form_field_set_id'])}`)
616
+ if (params.form_field_set_id && !isInt(params.form_field_set_id)) {
617
+ throw new errors.InvalidParameterError(`Bad parameter: form_field_set_id must be of type Int, received ${getType(params.form_field_set_id)}`)
606
618
  }
607
619
 
608
- if (params['expires_at'] && !isString(params['expires_at'])) {
609
- throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
620
+ if (params.expires_at && !isString(params.expires_at)) {
621
+ throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
610
622
  }
611
623
 
612
- if (params['max_uses'] && !isInt(params['max_uses'])) {
613
- throw new errors.InvalidParameterError(`Bad parameter: max_uses must be of type Int, received ${getType(params['max_uses'])}`)
624
+ if (params.max_uses && !isInt(params.max_uses)) {
625
+ throw new errors.InvalidParameterError(`Bad parameter: max_uses must be of type Int, received ${getType(params.max_uses)}`)
614
626
  }
615
627
 
616
- if (params['description'] && !isString(params['description'])) {
617
- throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params['description'])}`)
628
+ if (params.description && !isString(params.description)) {
629
+ throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
618
630
  }
619
631
 
620
- if (params['note'] && !isString(params['note'])) {
621
- throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params['note'])}`)
632
+ if (params.note && !isString(params.note)) {
633
+ throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
622
634
  }
623
635
 
624
- if (params['code'] && !isString(params['code'])) {
625
- throw new errors.InvalidParameterError(`Bad parameter: code must be of type String, received ${getType(params['code'])}`)
636
+ if (params.code && !isString(params.code)) {
637
+ throw new errors.InvalidParameterError(`Bad parameter: code must be of type String, received ${getType(params.code)}`)
626
638
  }
627
639
 
628
- if (params['path_template'] && !isString(params['path_template'])) {
629
- throw new errors.InvalidParameterError(`Bad parameter: path_template must be of type String, received ${getType(params['path_template'])}`)
640
+ if (params.path_template && !isString(params.path_template)) {
641
+ throw new errors.InvalidParameterError(`Bad parameter: path_template must be of type String, received ${getType(params.path_template)}`)
630
642
  }
631
643
 
632
- if (params['permissions'] && !isString(params['permissions'])) {
633
- throw new errors.InvalidParameterError(`Bad parameter: permissions must be of type String, received ${getType(params['permissions'])}`)
644
+ if (params.permissions && !isString(params.permissions)) {
645
+ throw new errors.InvalidParameterError(`Bad parameter: permissions must be of type String, received ${getType(params.permissions)}`)
634
646
  }
635
647
 
636
- if (params['clickwrap_id'] && !isInt(params['clickwrap_id'])) {
637
- throw new errors.InvalidParameterError(`Bad parameter: clickwrap_id must be of type Int, received ${getType(params['clickwrap_id'])}`)
648
+ if (params.clickwrap_id && !isInt(params.clickwrap_id)) {
649
+ throw new errors.InvalidParameterError(`Bad parameter: clickwrap_id must be of type Int, received ${getType(params.clickwrap_id)}`)
638
650
  }
639
651
 
640
- if (params['inbox_id'] && !isInt(params['inbox_id'])) {
641
- throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
652
+ if (params.inbox_id && !isInt(params.inbox_id)) {
653
+ throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
642
654
  }
643
655
 
644
- if (params['start_access_on_date'] && !isString(params['start_access_on_date'])) {
645
- throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params['start_access_on_date'])}`)
656
+ if (params.start_access_on_date && !isString(params.start_access_on_date)) {
657
+ throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params.start_access_on_date)}`)
646
658
  }
647
659
 
648
- if (params['snapshot_id'] && !isInt(params['snapshot_id'])) {
649
- throw new errors.InvalidParameterError(`Bad parameter: snapshot_id must be of type Int, received ${getType(params['snapshot_id'])}`)
660
+ if (params.snapshot_id && !isInt(params.snapshot_id)) {
661
+ throw new errors.InvalidParameterError(`Bad parameter: snapshot_id must be of type Int, received ${getType(params.snapshot_id)}`)
650
662
  }
651
663
 
652
- const response = await Api.sendRequest(`/bundles`, 'POST', params, options)
664
+ const response = await Api.sendRequest('/bundles', 'POST', params, options)
653
665
 
654
-
655
666
  return new Bundle(response?.data, options)
656
667
  }
657
668
  }
@@ -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 BundleDownload {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class BundleDownload {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // BundleRegistration
28
32
  getBundleRegistration = () => this.attributes.bundle_registration
29
33
 
@@ -36,7 +40,6 @@ class BundleDownload {
36
40
  // date-time # Download date/time
37
41
  getCreatedAt = () => this.attributes.created_at
38
42
 
39
-
40
43
  // Parameters:
41
44
  // 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.
42
45
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
@@ -49,25 +52,24 @@ class BundleDownload {
49
52
  // bundle_id - int64 - Bundle ID
50
53
  // bundle_registration_id - int64 - BundleRegistration ID
51
54
  static list = async (params = {}, options = {}) => {
52
- if (params['cursor'] && !isString(params['cursor'])) {
53
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
55
+ if (params.cursor && !isString(params.cursor)) {
56
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
54
57
  }
55
58
 
56
- if (params['per_page'] && !isInt(params['per_page'])) {
57
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
59
+ if (params.per_page && !isInt(params.per_page)) {
60
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
58
61
  }
59
62
 
60
- if (params['bundle_id'] && !isInt(params['bundle_id'])) {
61
- throw new errors.InvalidParameterError(`Bad parameter: bundle_id must be of type Int, received ${getType(params['bundle_id'])}`)
63
+ if (params.bundle_id && !isInt(params.bundle_id)) {
64
+ throw new errors.InvalidParameterError(`Bad parameter: bundle_id must be of type Int, received ${getType(params.bundle_id)}`)
62
65
  }
63
66
 
64
- if (params['bundle_registration_id'] && !isInt(params['bundle_registration_id'])) {
65
- throw new errors.InvalidParameterError(`Bad parameter: bundle_registration_id must be of type Int, received ${getType(params['bundle_registration_id'])}`)
67
+ if (params.bundle_registration_id && !isInt(params.bundle_registration_id)) {
68
+ throw new errors.InvalidParameterError(`Bad parameter: bundle_registration_id must be of type Int, received ${getType(params.bundle_registration_id)}`)
66
69
  }
67
70
 
68
- const response = await Api.sendRequest(`/bundle_downloads`, 'GET', params, options)
71
+ const response = await Api.sendRequest('/bundle_downloads', 'GET', params, options)
69
72
 
70
-
71
73
  return response?.data?.map(obj => new BundleDownload(obj, options)) || []
72
74
  }
73
75