files.com 1.0.221 → 1.0.223

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 (86) hide show
  1. package/_VERSION +1 -1
  2. package/docs/models/Bundle.md +14 -0
  3. package/lib/Api.js +15 -82
  4. package/lib/Errors.js +9 -962
  5. package/lib/Files.js +0 -11
  6. package/lib/Logger.js +0 -24
  7. package/lib/index.js +0 -5
  8. package/lib/isomorphic/File.node.js +0 -19
  9. package/lib/models/AccountLineItem.js +3 -21
  10. package/lib/models/Action.js +3 -21
  11. package/lib/models/ActionNotificationExport.js +9 -61
  12. package/lib/models/ActionNotificationExportResult.js +6 -40
  13. package/lib/models/ActionWebhookFailure.js +5 -39
  14. package/lib/models/ApiKey.js +23 -128
  15. package/lib/models/App.js +6 -34
  16. package/lib/models/As2IncomingMessage.js +6 -36
  17. package/lib/models/As2OutgoingMessage.js +6 -36
  18. package/lib/models/As2Partner.js +16 -112
  19. package/lib/models/As2Station.js +16 -108
  20. package/lib/models/Auto.js +3 -21
  21. package/lib/models/Automation.js +16 -146
  22. package/lib/models/AutomationRun.js +9 -54
  23. package/lib/models/BandwidthSnapshot.js +6 -34
  24. package/lib/models/Behavior.js +22 -151
  25. package/lib/models/Bundle.js +61 -177
  26. package/lib/models/BundleDownload.js +6 -38
  27. package/lib/models/BundleRecipient.js +9 -62
  28. package/lib/models/BundleRegistration.js +6 -38
  29. package/lib/models/Clickwrap.js +16 -106
  30. package/lib/models/DnsRecord.js +6 -34
  31. package/lib/models/Errors.js +3 -21
  32. package/lib/models/ExternalEvent.js +12 -62
  33. package/lib/models/File.js +21 -271
  34. package/lib/models/FileAction.js +3 -21
  35. package/lib/models/FileComment.js +13 -94
  36. package/lib/models/FileCommentReaction.js +8 -55
  37. package/lib/models/FileMigration.js +6 -37
  38. package/lib/models/FileUploadPart.js +3 -21
  39. package/lib/models/Folder.js +9 -63
  40. package/lib/models/FormField.js +3 -21
  41. package/lib/models/FormFieldSet.js +16 -98
  42. package/lib/models/Group.js +16 -104
  43. package/lib/models/GroupUser.js +13 -108
  44. package/lib/models/History.js +18 -132
  45. package/lib/models/HistoryExport.js +9 -87
  46. package/lib/models/HistoryExportResult.js +6 -40
  47. package/lib/models/Image.js +3 -21
  48. package/lib/models/InboxRecipient.js +9 -62
  49. package/lib/models/InboxRegistration.js +6 -36
  50. package/lib/models/InboxUpload.js +6 -38
  51. package/lib/models/Invoice.js +9 -48
  52. package/lib/models/InvoiceLineItem.js +3 -21
  53. package/lib/models/IpAddress.js +9 -45
  54. package/lib/models/Lock.js +11 -82
  55. package/lib/models/Message.js +16 -124
  56. package/lib/models/MessageComment.js +16 -104
  57. package/lib/models/MessageCommentReaction.js +14 -82
  58. package/lib/models/MessageReaction.js +14 -82
  59. package/lib/models/Notification.js +16 -120
  60. package/lib/models/Payment.js +9 -48
  61. package/lib/models/PaymentLineItem.js +3 -21
  62. package/lib/models/Permission.js +11 -72
  63. package/lib/models/Preview.js +3 -21
  64. package/lib/models/Priority.js +6 -42
  65. package/lib/models/Project.js +16 -96
  66. package/lib/models/PublicIpAddress.js +3 -21
  67. package/lib/models/PublicKey.js +16 -104
  68. package/lib/models/RemoteBandwidthSnapshot.js +6 -34
  69. package/lib/models/RemoteServer.js +16 -270
  70. package/lib/models/Request.js +14 -89
  71. package/lib/models/Session.js +8 -41
  72. package/lib/models/SettingsChange.js +6 -34
  73. package/lib/models/SftpHostKey.js +16 -94
  74. package/lib/models/Site.js +10 -157
  75. package/lib/models/SsoStrategy.js +11 -64
  76. package/lib/models/Status.js +3 -21
  77. package/lib/models/Style.js +10 -73
  78. package/lib/models/UsageDailySnapshot.js +6 -34
  79. package/lib/models/UsageSnapshot.js +6 -34
  80. package/lib/models/User.js +22 -238
  81. package/lib/models/UserCipherUse.js +6 -36
  82. package/lib/models/UserRequest.js +14 -82
  83. package/lib/models/WebhookTest.js +6 -43
  84. package/lib/utils.js +0 -16
  85. package/package.json +1 -1
  86. package/src/models/Bundle.js +25 -0
@@ -1,46 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  exports.__esModule = true;
8
6
  exports.default = void 0;
9
-
10
7
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
-
16
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
-
20
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
-
22
13
  var _Api = _interopRequireDefault(require("../Api"));
23
-
24
14
  var errors = _interopRequireWildcard(require("../Errors"));
25
-
26
15
  var _Logger = _interopRequireDefault(require("../Logger"));
27
-
28
16
  var _utils = require("../utils");
29
-
30
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
-
32
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
-
34
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
-
36
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
-
38
21
  /**
39
22
  * Class User
40
- */
41
- var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
23
+ */var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
42
24
  var _this = this;
43
-
44
25
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
45
26
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46
27
  (0, _classCallCheck2.default)(this, User);
@@ -453,65 +434,51 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
453
434
  });
454
435
  (0, _defineProperty2.default)(this, "unlock", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
455
436
  var params,
456
- response,
457
- _args = arguments;
437
+ response,
438
+ _args = arguments;
458
439
  return _regenerator.default.wrap(function _callee$(_context) {
459
440
  while (1) {
460
441
  switch (_context.prev = _context.next) {
461
442
  case 0:
462
443
  params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
463
-
464
444
  if (_this.attributes.id) {
465
445
  _context.next = 3;
466
446
  break;
467
447
  }
468
-
469
448
  throw new errors.EmptyPropertyError('Current object has no id');
470
-
471
449
  case 3:
472
450
  if ((0, _utils.isObject)(params)) {
473
451
  _context.next = 5;
474
452
  break;
475
453
  }
476
-
477
454
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
478
-
479
455
  case 5:
480
456
  params.id = _this.attributes.id;
481
-
482
457
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
483
458
  _context.next = 8;
484
459
  break;
485
460
  }
486
-
487
461
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
488
-
489
462
  case 8:
490
463
  if (params['id']) {
491
464
  _context.next = 14;
492
465
  break;
493
466
  }
494
-
495
467
  if (!_this.attributes.id) {
496
468
  _context.next = 13;
497
469
  break;
498
470
  }
499
-
500
471
  params['id'] = _this.id;
501
472
  _context.next = 14;
502
473
  break;
503
-
504
474
  case 13:
505
475
  throw new errors.MissingParameterError('Parameter missing: id');
506
-
507
476
  case 14:
508
477
  _context.next = 16;
509
478
  return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id']), "/unlock"), 'POST', params, _this.options);
510
-
511
479
  case 16:
512
480
  response = _context.sent;
513
481
  return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
514
-
515
482
  case 18:
516
483
  case "end":
517
484
  return _context.stop();
@@ -521,65 +488,51 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
521
488
  })));
522
489
  (0, _defineProperty2.default)(this, "resendWelcomeEmail", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
523
490
  var params,
524
- response,
525
- _args2 = arguments;
491
+ response,
492
+ _args2 = arguments;
526
493
  return _regenerator.default.wrap(function _callee2$(_context2) {
527
494
  while (1) {
528
495
  switch (_context2.prev = _context2.next) {
529
496
  case 0:
530
497
  params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
531
-
532
498
  if (_this.attributes.id) {
533
499
  _context2.next = 3;
534
500
  break;
535
501
  }
536
-
537
502
  throw new errors.EmptyPropertyError('Current object has no id');
538
-
539
503
  case 3:
540
504
  if ((0, _utils.isObject)(params)) {
541
505
  _context2.next = 5;
542
506
  break;
543
507
  }
544
-
545
508
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
546
-
547
509
  case 5:
548
510
  params.id = _this.attributes.id;
549
-
550
511
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
551
512
  _context2.next = 8;
552
513
  break;
553
514
  }
554
-
555
515
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
556
-
557
516
  case 8:
558
517
  if (params['id']) {
559
518
  _context2.next = 14;
560
519
  break;
561
520
  }
562
-
563
521
  if (!_this.attributes.id) {
564
522
  _context2.next = 13;
565
523
  break;
566
524
  }
567
-
568
525
  params['id'] = _this.id;
569
526
  _context2.next = 14;
570
527
  break;
571
-
572
528
  case 13:
573
529
  throw new errors.MissingParameterError('Parameter missing: id');
574
-
575
530
  case 14:
576
531
  _context2.next = 16;
577
532
  return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id']), "/resend_welcome_email"), 'POST', params, _this.options);
578
-
579
533
  case 16:
580
534
  response = _context2.sent;
581
535
  return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
582
-
583
536
  case 18:
584
537
  case "end":
585
538
  return _context2.stop();
@@ -589,65 +542,51 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
589
542
  })));
590
543
  (0, _defineProperty2.default)(this, "user2faReset", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
591
544
  var params,
592
- response,
593
- _args3 = arguments;
545
+ response,
546
+ _args3 = arguments;
594
547
  return _regenerator.default.wrap(function _callee3$(_context3) {
595
548
  while (1) {
596
549
  switch (_context3.prev = _context3.next) {
597
550
  case 0:
598
551
  params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
599
-
600
552
  if (_this.attributes.id) {
601
553
  _context3.next = 3;
602
554
  break;
603
555
  }
604
-
605
556
  throw new errors.EmptyPropertyError('Current object has no id');
606
-
607
557
  case 3:
608
558
  if ((0, _utils.isObject)(params)) {
609
559
  _context3.next = 5;
610
560
  break;
611
561
  }
612
-
613
562
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
614
-
615
563
  case 5:
616
564
  params.id = _this.attributes.id;
617
-
618
565
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
619
566
  _context3.next = 8;
620
567
  break;
621
568
  }
622
-
623
569
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
624
-
625
570
  case 8:
626
571
  if (params['id']) {
627
572
  _context3.next = 14;
628
573
  break;
629
574
  }
630
-
631
575
  if (!_this.attributes.id) {
632
576
  _context3.next = 13;
633
577
  break;
634
578
  }
635
-
636
579
  params['id'] = _this.id;
637
580
  _context3.next = 14;
638
581
  break;
639
-
640
582
  case 13:
641
583
  throw new errors.MissingParameterError('Parameter missing: id');
642
-
643
584
  case 14:
644
585
  _context3.next = 16;
645
586
  return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id']), "/2fa/reset"), 'POST', params, _this.options);
646
-
647
587
  case 16:
648
588
  response = _context3.sent;
649
589
  return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
650
-
651
590
  case 18:
652
591
  case "end":
653
592
  return _context3.stop();
@@ -657,265 +596,201 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
657
596
  })));
658
597
  (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
659
598
  var params,
660
- response,
661
- _args4 = arguments;
599
+ response,
600
+ _args4 = arguments;
662
601
  return _regenerator.default.wrap(function _callee4$(_context4) {
663
602
  while (1) {
664
603
  switch (_context4.prev = _context4.next) {
665
604
  case 0:
666
605
  params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
667
-
668
606
  if (_this.attributes.id) {
669
607
  _context4.next = 3;
670
608
  break;
671
609
  }
672
-
673
610
  throw new errors.EmptyPropertyError('Current object has no id');
674
-
675
611
  case 3:
676
612
  if ((0, _utils.isObject)(params)) {
677
613
  _context4.next = 5;
678
614
  break;
679
615
  }
680
-
681
616
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
682
-
683
617
  case 5:
684
618
  params.id = _this.attributes.id;
685
-
686
619
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
687
620
  _context4.next = 8;
688
621
  break;
689
622
  }
690
-
691
623
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
692
-
693
624
  case 8:
694
625
  if (!(params['change_password'] && !(0, _utils.isString)(params['change_password']))) {
695
626
  _context4.next = 10;
696
627
  break;
697
628
  }
698
-
699
629
  throw new errors.InvalidParameterError("Bad parameter: change_password must be of type String, received ".concat((0, _utils.getType)(change_password)));
700
-
701
630
  case 10:
702
631
  if (!(params['change_password_confirmation'] && !(0, _utils.isString)(params['change_password_confirmation']))) {
703
632
  _context4.next = 12;
704
633
  break;
705
634
  }
706
-
707
635
  throw new errors.InvalidParameterError("Bad parameter: change_password_confirmation must be of type String, received ".concat((0, _utils.getType)(change_password_confirmation)));
708
-
709
636
  case 12:
710
637
  if (!(params['email'] && !(0, _utils.isString)(params['email']))) {
711
638
  _context4.next = 14;
712
639
  break;
713
640
  }
714
-
715
641
  throw new errors.InvalidParameterError("Bad parameter: email must be of type String, received ".concat((0, _utils.getType)(email)));
716
-
717
642
  case 14:
718
643
  if (!(params['grant_permission'] && !(0, _utils.isString)(params['grant_permission']))) {
719
644
  _context4.next = 16;
720
645
  break;
721
646
  }
722
-
723
647
  throw new errors.InvalidParameterError("Bad parameter: grant_permission must be of type String, received ".concat((0, _utils.getType)(grant_permission)));
724
-
725
648
  case 16:
726
649
  if (!(params['group_id'] && !(0, _utils.isInt)(params['group_id']))) {
727
650
  _context4.next = 18;
728
651
  break;
729
652
  }
730
-
731
653
  throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(group_id)));
732
-
733
654
  case 18:
734
655
  if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
735
656
  _context4.next = 20;
736
657
  break;
737
658
  }
738
-
739
659
  throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(group_ids)));
740
-
741
660
  case 20:
742
661
  if (!(params['imported_password_hash'] && !(0, _utils.isString)(params['imported_password_hash']))) {
743
662
  _context4.next = 22;
744
663
  break;
745
664
  }
746
-
747
665
  throw new errors.InvalidParameterError("Bad parameter: imported_password_hash must be of type String, received ".concat((0, _utils.getType)(imported_password_hash)));
748
-
749
666
  case 22:
750
667
  if (!(params['password'] && !(0, _utils.isString)(params['password']))) {
751
668
  _context4.next = 24;
752
669
  break;
753
670
  }
754
-
755
671
  throw new errors.InvalidParameterError("Bad parameter: password must be of type String, received ".concat((0, _utils.getType)(password)));
756
-
757
672
  case 24:
758
673
  if (!(params['password_confirmation'] && !(0, _utils.isString)(params['password_confirmation']))) {
759
674
  _context4.next = 26;
760
675
  break;
761
676
  }
762
-
763
677
  throw new errors.InvalidParameterError("Bad parameter: password_confirmation must be of type String, received ".concat((0, _utils.getType)(password_confirmation)));
764
-
765
678
  case 26:
766
679
  if (!(params['allowed_ips'] && !(0, _utils.isString)(params['allowed_ips']))) {
767
680
  _context4.next = 28;
768
681
  break;
769
682
  }
770
-
771
683
  throw new errors.InvalidParameterError("Bad parameter: allowed_ips must be of type String, received ".concat((0, _utils.getType)(allowed_ips)));
772
-
773
684
  case 28:
774
685
  if (!(params['authenticate_until'] && !(0, _utils.isString)(params['authenticate_until']))) {
775
686
  _context4.next = 30;
776
687
  break;
777
688
  }
778
-
779
689
  throw new errors.InvalidParameterError("Bad parameter: authenticate_until must be of type String, received ".concat((0, _utils.getType)(authenticate_until)));
780
-
781
690
  case 30:
782
691
  if (!(params['authentication_method'] && !(0, _utils.isString)(params['authentication_method']))) {
783
692
  _context4.next = 32;
784
693
  break;
785
694
  }
786
-
787
695
  throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(authentication_method)));
788
-
789
696
  case 32:
790
697
  if (!(params['header_text'] && !(0, _utils.isString)(params['header_text']))) {
791
698
  _context4.next = 34;
792
699
  break;
793
700
  }
794
-
795
701
  throw new errors.InvalidParameterError("Bad parameter: header_text must be of type String, received ".concat((0, _utils.getType)(header_text)));
796
-
797
702
  case 34:
798
703
  if (!(params['language'] && !(0, _utils.isString)(params['language']))) {
799
704
  _context4.next = 36;
800
705
  break;
801
706
  }
802
-
803
707
  throw new errors.InvalidParameterError("Bad parameter: language must be of type String, received ".concat((0, _utils.getType)(language)));
804
-
805
708
  case 36:
806
709
  if (!(params['notification_daily_send_time'] && !(0, _utils.isInt)(params['notification_daily_send_time']))) {
807
710
  _context4.next = 38;
808
711
  break;
809
712
  }
810
-
811
713
  throw new errors.InvalidParameterError("Bad parameter: notification_daily_send_time must be of type Int, received ".concat((0, _utils.getType)(notification_daily_send_time)));
812
-
813
714
  case 38:
814
715
  if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
815
716
  _context4.next = 40;
816
717
  break;
817
718
  }
818
-
819
719
  throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
820
-
821
720
  case 40:
822
721
  if (!(params['company'] && !(0, _utils.isString)(params['company']))) {
823
722
  _context4.next = 42;
824
723
  break;
825
724
  }
826
-
827
725
  throw new errors.InvalidParameterError("Bad parameter: company must be of type String, received ".concat((0, _utils.getType)(company)));
828
-
829
726
  case 42:
830
727
  if (!(params['notes'] && !(0, _utils.isString)(params['notes']))) {
831
728
  _context4.next = 44;
832
729
  break;
833
730
  }
834
-
835
731
  throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(notes)));
836
-
837
732
  case 44:
838
733
  if (!(params['password_validity_days'] && !(0, _utils.isInt)(params['password_validity_days']))) {
839
734
  _context4.next = 46;
840
735
  break;
841
736
  }
842
-
843
737
  throw new errors.InvalidParameterError("Bad parameter: password_validity_days must be of type Int, received ".concat((0, _utils.getType)(password_validity_days)));
844
-
845
738
  case 46:
846
739
  if (!(params['ssl_required'] && !(0, _utils.isString)(params['ssl_required']))) {
847
740
  _context4.next = 48;
848
741
  break;
849
742
  }
850
-
851
743
  throw new errors.InvalidParameterError("Bad parameter: ssl_required must be of type String, received ".concat((0, _utils.getType)(ssl_required)));
852
-
853
744
  case 48:
854
745
  if (!(params['sso_strategy_id'] && !(0, _utils.isInt)(params['sso_strategy_id']))) {
855
746
  _context4.next = 50;
856
747
  break;
857
748
  }
858
-
859
749
  throw new errors.InvalidParameterError("Bad parameter: sso_strategy_id must be of type Int, received ".concat((0, _utils.getType)(sso_strategy_id)));
860
-
861
750
  case 50:
862
751
  if (!(params['require_2fa'] && !(0, _utils.isString)(params['require_2fa']))) {
863
752
  _context4.next = 52;
864
753
  break;
865
754
  }
866
-
867
755
  throw new errors.InvalidParameterError("Bad parameter: require_2fa must be of type String, received ".concat((0, _utils.getType)(require_2fa)));
868
-
869
756
  case 52:
870
757
  if (!(params['time_zone'] && !(0, _utils.isString)(params['time_zone']))) {
871
758
  _context4.next = 54;
872
759
  break;
873
760
  }
874
-
875
761
  throw new errors.InvalidParameterError("Bad parameter: time_zone must be of type String, received ".concat((0, _utils.getType)(time_zone)));
876
-
877
762
  case 54:
878
763
  if (!(params['user_root'] && !(0, _utils.isString)(params['user_root']))) {
879
764
  _context4.next = 56;
880
765
  break;
881
766
  }
882
-
883
767
  throw new errors.InvalidParameterError("Bad parameter: user_root must be of type String, received ".concat((0, _utils.getType)(user_root)));
884
-
885
768
  case 56:
886
769
  if (!(params['username'] && !(0, _utils.isString)(params['username']))) {
887
770
  _context4.next = 58;
888
771
  break;
889
772
  }
890
-
891
773
  throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(username)));
892
-
893
774
  case 58:
894
775
  if (params['id']) {
895
776
  _context4.next = 64;
896
777
  break;
897
778
  }
898
-
899
779
  if (!_this.attributes.id) {
900
780
  _context4.next = 63;
901
781
  break;
902
782
  }
903
-
904
783
  params['id'] = _this.id;
905
784
  _context4.next = 64;
906
785
  break;
907
-
908
786
  case 63:
909
787
  throw new errors.MissingParameterError('Parameter missing: id');
910
-
911
788
  case 64:
912
789
  _context4.next = 66;
913
790
  return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
914
-
915
791
  case 66:
916
792
  response = _context4.sent;
917
793
  return _context4.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, _this.options));
918
-
919
794
  case 68:
920
795
  case "end":
921
796
  return _context4.stop();
@@ -925,65 +800,51 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
925
800
  })));
926
801
  (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
927
802
  var params,
928
- response,
929
- _args5 = arguments;
803
+ response,
804
+ _args5 = arguments;
930
805
  return _regenerator.default.wrap(function _callee5$(_context5) {
931
806
  while (1) {
932
807
  switch (_context5.prev = _context5.next) {
933
808
  case 0:
934
809
  params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
935
-
936
810
  if (_this.attributes.id) {
937
811
  _context5.next = 3;
938
812
  break;
939
813
  }
940
-
941
814
  throw new errors.EmptyPropertyError('Current object has no id');
942
-
943
815
  case 3:
944
816
  if ((0, _utils.isObject)(params)) {
945
817
  _context5.next = 5;
946
818
  break;
947
819
  }
948
-
949
820
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
950
-
951
821
  case 5:
952
822
  params.id = _this.attributes.id;
953
-
954
823
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
955
824
  _context5.next = 8;
956
825
  break;
957
826
  }
958
-
959
827
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
960
-
961
828
  case 8:
962
829
  if (params['id']) {
963
830
  _context5.next = 14;
964
831
  break;
965
832
  }
966
-
967
833
  if (!_this.attributes.id) {
968
834
  _context5.next = 13;
969
835
  break;
970
836
  }
971
-
972
837
  params['id'] = _this.id;
973
838
  _context5.next = 14;
974
839
  break;
975
-
976
840
  case 13:
977
841
  throw new errors.MissingParameterError('Parameter missing: id');
978
-
979
842
  case 14:
980
843
  _context5.next = 16;
981
844
  return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
982
-
983
845
  case 16:
984
846
  response = _context5.sent;
985
847
  return _context5.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
986
-
987
848
  case 18:
988
849
  case "end":
989
850
  return _context5.stop();
@@ -1006,9 +867,8 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
1006
867
  });
1007
868
  Object.entries(attributes).forEach(function (_ref6) {
1008
869
  var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
1009
- key = _ref7[0],
1010
- value = _ref7[1];
1011
-
870
+ key = _ref7[0],
871
+ value = _ref7[1];
1012
872
  var normalizedKey = key.replace('?', '');
1013
873
  _this.attributes[normalizedKey] = value;
1014
874
  Object.defineProperty(_this, normalizedKey, {
@@ -1020,59 +880,47 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
1020
880
  });
1021
881
  (0, _defineProperty2.default)(User, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1022
882
  var _response$data;
1023
-
1024
883
  var params,
1025
- options,
1026
- response,
1027
- _args6 = arguments;
884
+ options,
885
+ response,
886
+ _args6 = arguments;
1028
887
  return _regenerator.default.wrap(function _callee6$(_context6) {
1029
888
  while (1) {
1030
889
  switch (_context6.prev = _context6.next) {
1031
890
  case 0:
1032
891
  params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
1033
892
  options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
1034
-
1035
893
  if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
1036
894
  _context6.next = 4;
1037
895
  break;
1038
896
  }
1039
-
1040
897
  throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
1041
-
1042
898
  case 4:
1043
899
  if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
1044
900
  _context6.next = 6;
1045
901
  break;
1046
902
  }
1047
-
1048
903
  throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
1049
-
1050
904
  case 6:
1051
905
  if (!(params['ids'] && !(0, _utils.isString)(params['ids']))) {
1052
906
  _context6.next = 8;
1053
907
  break;
1054
908
  }
1055
-
1056
909
  throw new errors.InvalidParameterError("Bad parameter: ids must be of type String, received ".concat((0, _utils.getType)(params['ids'])));
1057
-
1058
910
  case 8:
1059
911
  if (!(params['search'] && !(0, _utils.isString)(params['search']))) {
1060
912
  _context6.next = 10;
1061
913
  break;
1062
914
  }
1063
-
1064
915
  throw new errors.InvalidParameterError("Bad parameter: search must be of type String, received ".concat((0, _utils.getType)(params['search'])));
1065
-
1066
916
  case 10:
1067
917
  _context6.next = 12;
1068
918
  return _Api.default.sendRequest("/users", 'GET', params, options);
1069
-
1070
919
  case 12:
1071
920
  response = _context6.sent;
1072
921
  return _context6.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
1073
922
  return new User(obj, options);
1074
923
  })) || []);
1075
-
1076
924
  case 14:
1077
925
  case "end":
1078
926
  return _context6.stop();
@@ -1088,49 +936,39 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
1088
936
  (0, _defineProperty2.default)(User, "find", /*#__PURE__*/function () {
1089
937
  var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id) {
1090
938
  var params,
1091
- options,
1092
- response,
1093
- _args7 = arguments;
939
+ options,
940
+ response,
941
+ _args7 = arguments;
1094
942
  return _regenerator.default.wrap(function _callee7$(_context7) {
1095
943
  while (1) {
1096
944
  switch (_context7.prev = _context7.next) {
1097
945
  case 0:
1098
946
  params = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
1099
947
  options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
1100
-
1101
948
  if ((0, _utils.isObject)(params)) {
1102
949
  _context7.next = 4;
1103
950
  break;
1104
951
  }
1105
-
1106
952
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
1107
-
1108
953
  case 4:
1109
954
  params['id'] = id;
1110
-
1111
955
  if (params['id']) {
1112
956
  _context7.next = 7;
1113
957
  break;
1114
958
  }
1115
-
1116
959
  throw new errors.MissingParameterError('Parameter missing: id');
1117
-
1118
960
  case 7:
1119
961
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
1120
962
  _context7.next = 9;
1121
963
  break;
1122
964
  }
1123
-
1124
965
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
1125
-
1126
966
  case 9:
1127
967
  _context7.next = 11;
1128
968
  return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
1129
-
1130
969
  case 11:
1131
970
  response = _context7.sent;
1132
971
  return _context7.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, options));
1133
-
1134
972
  case 13:
1135
973
  case "end":
1136
974
  return _context7.stop();
@@ -1138,7 +976,6 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
1138
976
  }
1139
977
  }, _callee7);
1140
978
  }));
1141
-
1142
979
  return function (_x) {
1143
980
  return _ref9.apply(this, arguments);
1144
981
  };
@@ -1150,223 +987,170 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
1150
987
  });
1151
988
  (0, _defineProperty2.default)(User, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1152
989
  var params,
1153
- options,
1154
- response,
1155
- _args8 = arguments;
990
+ options,
991
+ response,
992
+ _args8 = arguments;
1156
993
  return _regenerator.default.wrap(function _callee8$(_context8) {
1157
994
  while (1) {
1158
995
  switch (_context8.prev = _context8.next) {
1159
996
  case 0:
1160
997
  params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
1161
998
  options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
1162
-
1163
999
  if (!(params['change_password'] && !(0, _utils.isString)(params['change_password']))) {
1164
1000
  _context8.next = 4;
1165
1001
  break;
1166
1002
  }
1167
-
1168
1003
  throw new errors.InvalidParameterError("Bad parameter: change_password must be of type String, received ".concat((0, _utils.getType)(params['change_password'])));
1169
-
1170
1004
  case 4:
1171
1005
  if (!(params['change_password_confirmation'] && !(0, _utils.isString)(params['change_password_confirmation']))) {
1172
1006
  _context8.next = 6;
1173
1007
  break;
1174
1008
  }
1175
-
1176
1009
  throw new errors.InvalidParameterError("Bad parameter: change_password_confirmation must be of type String, received ".concat((0, _utils.getType)(params['change_password_confirmation'])));
1177
-
1178
1010
  case 6:
1179
1011
  if (!(params['email'] && !(0, _utils.isString)(params['email']))) {
1180
1012
  _context8.next = 8;
1181
1013
  break;
1182
1014
  }
1183
-
1184
1015
  throw new errors.InvalidParameterError("Bad parameter: email must be of type String, received ".concat((0, _utils.getType)(params['email'])));
1185
-
1186
1016
  case 8:
1187
1017
  if (!(params['grant_permission'] && !(0, _utils.isString)(params['grant_permission']))) {
1188
1018
  _context8.next = 10;
1189
1019
  break;
1190
1020
  }
1191
-
1192
1021
  throw new errors.InvalidParameterError("Bad parameter: grant_permission must be of type String, received ".concat((0, _utils.getType)(params['grant_permission'])));
1193
-
1194
1022
  case 10:
1195
1023
  if (!(params['group_id'] && !(0, _utils.isInt)(params['group_id']))) {
1196
1024
  _context8.next = 12;
1197
1025
  break;
1198
1026
  }
1199
-
1200
1027
  throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(params['group_id'])));
1201
-
1202
1028
  case 12:
1203
1029
  if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
1204
1030
  _context8.next = 14;
1205
1031
  break;
1206
1032
  }
1207
-
1208
1033
  throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(params['group_ids'])));
1209
-
1210
1034
  case 14:
1211
1035
  if (!(params['imported_password_hash'] && !(0, _utils.isString)(params['imported_password_hash']))) {
1212
1036
  _context8.next = 16;
1213
1037
  break;
1214
1038
  }
1215
-
1216
1039
  throw new errors.InvalidParameterError("Bad parameter: imported_password_hash must be of type String, received ".concat((0, _utils.getType)(params['imported_password_hash'])));
1217
-
1218
1040
  case 16:
1219
1041
  if (!(params['password'] && !(0, _utils.isString)(params['password']))) {
1220
1042
  _context8.next = 18;
1221
1043
  break;
1222
1044
  }
1223
-
1224
1045
  throw new errors.InvalidParameterError("Bad parameter: password must be of type String, received ".concat((0, _utils.getType)(params['password'])));
1225
-
1226
1046
  case 18:
1227
1047
  if (!(params['password_confirmation'] && !(0, _utils.isString)(params['password_confirmation']))) {
1228
1048
  _context8.next = 20;
1229
1049
  break;
1230
1050
  }
1231
-
1232
1051
  throw new errors.InvalidParameterError("Bad parameter: password_confirmation must be of type String, received ".concat((0, _utils.getType)(params['password_confirmation'])));
1233
-
1234
1052
  case 20:
1235
1053
  if (!(params['allowed_ips'] && !(0, _utils.isString)(params['allowed_ips']))) {
1236
1054
  _context8.next = 22;
1237
1055
  break;
1238
1056
  }
1239
-
1240
1057
  throw new errors.InvalidParameterError("Bad parameter: allowed_ips must be of type String, received ".concat((0, _utils.getType)(params['allowed_ips'])));
1241
-
1242
1058
  case 22:
1243
1059
  if (!(params['authenticate_until'] && !(0, _utils.isString)(params['authenticate_until']))) {
1244
1060
  _context8.next = 24;
1245
1061
  break;
1246
1062
  }
1247
-
1248
1063
  throw new errors.InvalidParameterError("Bad parameter: authenticate_until must be of type String, received ".concat((0, _utils.getType)(params['authenticate_until'])));
1249
-
1250
1064
  case 24:
1251
1065
  if (!(params['authentication_method'] && !(0, _utils.isString)(params['authentication_method']))) {
1252
1066
  _context8.next = 26;
1253
1067
  break;
1254
1068
  }
1255
-
1256
1069
  throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(params['authentication_method'])));
1257
-
1258
1070
  case 26:
1259
1071
  if (!(params['header_text'] && !(0, _utils.isString)(params['header_text']))) {
1260
1072
  _context8.next = 28;
1261
1073
  break;
1262
1074
  }
1263
-
1264
1075
  throw new errors.InvalidParameterError("Bad parameter: header_text must be of type String, received ".concat((0, _utils.getType)(params['header_text'])));
1265
-
1266
1076
  case 28:
1267
1077
  if (!(params['language'] && !(0, _utils.isString)(params['language']))) {
1268
1078
  _context8.next = 30;
1269
1079
  break;
1270
1080
  }
1271
-
1272
1081
  throw new errors.InvalidParameterError("Bad parameter: language must be of type String, received ".concat((0, _utils.getType)(params['language'])));
1273
-
1274
1082
  case 30:
1275
1083
  if (!(params['notification_daily_send_time'] && !(0, _utils.isInt)(params['notification_daily_send_time']))) {
1276
1084
  _context8.next = 32;
1277
1085
  break;
1278
1086
  }
1279
-
1280
1087
  throw new errors.InvalidParameterError("Bad parameter: notification_daily_send_time must be of type Int, received ".concat((0, _utils.getType)(params['notification_daily_send_time'])));
1281
-
1282
1088
  case 32:
1283
1089
  if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
1284
1090
  _context8.next = 34;
1285
1091
  break;
1286
1092
  }
1287
-
1288
1093
  throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
1289
-
1290
1094
  case 34:
1291
1095
  if (!(params['company'] && !(0, _utils.isString)(params['company']))) {
1292
1096
  _context8.next = 36;
1293
1097
  break;
1294
1098
  }
1295
-
1296
1099
  throw new errors.InvalidParameterError("Bad parameter: company must be of type String, received ".concat((0, _utils.getType)(params['company'])));
1297
-
1298
1100
  case 36:
1299
1101
  if (!(params['notes'] && !(0, _utils.isString)(params['notes']))) {
1300
1102
  _context8.next = 38;
1301
1103
  break;
1302
1104
  }
1303
-
1304
1105
  throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(params['notes'])));
1305
-
1306
1106
  case 38:
1307
1107
  if (!(params['password_validity_days'] && !(0, _utils.isInt)(params['password_validity_days']))) {
1308
1108
  _context8.next = 40;
1309
1109
  break;
1310
1110
  }
1311
-
1312
1111
  throw new errors.InvalidParameterError("Bad parameter: password_validity_days must be of type Int, received ".concat((0, _utils.getType)(params['password_validity_days'])));
1313
-
1314
1112
  case 40:
1315
1113
  if (!(params['ssl_required'] && !(0, _utils.isString)(params['ssl_required']))) {
1316
1114
  _context8.next = 42;
1317
1115
  break;
1318
1116
  }
1319
-
1320
1117
  throw new errors.InvalidParameterError("Bad parameter: ssl_required must be of type String, received ".concat((0, _utils.getType)(params['ssl_required'])));
1321
-
1322
1118
  case 42:
1323
1119
  if (!(params['sso_strategy_id'] && !(0, _utils.isInt)(params['sso_strategy_id']))) {
1324
1120
  _context8.next = 44;
1325
1121
  break;
1326
1122
  }
1327
-
1328
1123
  throw new errors.InvalidParameterError("Bad parameter: sso_strategy_id must be of type Int, received ".concat((0, _utils.getType)(params['sso_strategy_id'])));
1329
-
1330
1124
  case 44:
1331
1125
  if (!(params['require_2fa'] && !(0, _utils.isString)(params['require_2fa']))) {
1332
1126
  _context8.next = 46;
1333
1127
  break;
1334
1128
  }
1335
-
1336
1129
  throw new errors.InvalidParameterError("Bad parameter: require_2fa must be of type String, received ".concat((0, _utils.getType)(params['require_2fa'])));
1337
-
1338
1130
  case 46:
1339
1131
  if (!(params['time_zone'] && !(0, _utils.isString)(params['time_zone']))) {
1340
1132
  _context8.next = 48;
1341
1133
  break;
1342
1134
  }
1343
-
1344
1135
  throw new errors.InvalidParameterError("Bad parameter: time_zone must be of type String, received ".concat((0, _utils.getType)(params['time_zone'])));
1345
-
1346
1136
  case 48:
1347
1137
  if (!(params['user_root'] && !(0, _utils.isString)(params['user_root']))) {
1348
1138
  _context8.next = 50;
1349
1139
  break;
1350
1140
  }
1351
-
1352
1141
  throw new errors.InvalidParameterError("Bad parameter: user_root must be of type String, received ".concat((0, _utils.getType)(params['user_root'])));
1353
-
1354
1142
  case 50:
1355
1143
  if (!(params['username'] && !(0, _utils.isString)(params['username']))) {
1356
1144
  _context8.next = 52;
1357
1145
  break;
1358
1146
  }
1359
-
1360
1147
  throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(params['username'])));
1361
-
1362
1148
  case 52:
1363
1149
  _context8.next = 54;
1364
1150
  return _Api.default.sendRequest("/users", 'POST', params, options);
1365
-
1366
1151
  case 54:
1367
1152
  response = _context8.sent;
1368
1153
  return _context8.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, options));
1369
-
1370
1154
  case 56:
1371
1155
  case "end":
1372
1156
  return _context8.stop();