files.com 1.0.474 → 1.1.1

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 (88) hide show
  1. package/_VERSION +1 -1
  2. package/lib/Files.js +1 -1
  3. package/lib/models/ActionNotificationExport.js +63 -49
  4. package/lib/models/ActionWebhookFailure.js +1 -1
  5. package/lib/models/ApiKey.js +113 -94
  6. package/lib/models/As2Partner.js +81 -62
  7. package/lib/models/As2Station.js +79 -60
  8. package/lib/models/Automation.js +90 -71
  9. package/lib/models/Behavior.js +114 -95
  10. package/lib/models/Bundle.js +90 -71
  11. package/lib/models/BundleNotification.js +75 -56
  12. package/lib/models/BundleRecipient.js +61 -47
  13. package/lib/models/Clickwrap.js +77 -58
  14. package/lib/models/ExternalEvent.js +71 -57
  15. package/lib/models/File.js +166 -154
  16. package/lib/models/FileComment.js +65 -46
  17. package/lib/models/FileCommentReaction.js +44 -30
  18. package/lib/models/Folder.js +58 -46
  19. package/lib/models/FormFieldSet.js +76 -57
  20. package/lib/models/GpgKey.js +79 -60
  21. package/lib/models/Group.js +78 -59
  22. package/lib/models/GroupUser.js +63 -44
  23. package/lib/models/HistoryExport.js +76 -62
  24. package/lib/models/InboxRecipient.js +61 -47
  25. package/lib/models/Lock.js +56 -44
  26. package/lib/models/Message.js +82 -63
  27. package/lib/models/MessageComment.js +78 -59
  28. package/lib/models/MessageCommentReaction.js +73 -59
  29. package/lib/models/MessageReaction.js +73 -59
  30. package/lib/models/Notification.js +84 -65
  31. package/lib/models/Permission.js +60 -46
  32. package/lib/models/Project.js +74 -55
  33. package/lib/models/PublicKey.js +78 -59
  34. package/lib/models/RemoteServer.js +147 -128
  35. package/lib/models/Request.js +76 -62
  36. package/lib/models/Session.js +53 -39
  37. package/lib/models/SftpHostKey.js +74 -55
  38. package/lib/models/ShareGroup.js +79 -60
  39. package/lib/models/Snapshot.js +75 -56
  40. package/lib/models/SsoStrategy.js +1 -1
  41. package/lib/models/Style.js +37 -23
  42. package/lib/models/User.js +104 -85
  43. package/lib/models/UserRequest.js +73 -59
  44. package/lib/models/WebhookTest.js +46 -32
  45. package/package.json +1 -1
  46. package/src/Files.js +1 -1
  47. package/src/models/ActionNotificationExport.js +2 -2
  48. package/src/models/ActionWebhookFailure.js +1 -1
  49. package/src/models/ApiKey.js +7 -5
  50. package/src/models/As2Partner.js +6 -4
  51. package/src/models/As2Station.js +6 -4
  52. package/src/models/Automation.js +7 -5
  53. package/src/models/Behavior.js +7 -5
  54. package/src/models/Bundle.js +7 -5
  55. package/src/models/BundleNotification.js +6 -4
  56. package/src/models/BundleRecipient.js +2 -2
  57. package/src/models/Clickwrap.js +6 -4
  58. package/src/models/ExternalEvent.js +2 -2
  59. package/src/models/File.js +3 -3
  60. package/src/models/FileComment.js +6 -4
  61. package/src/models/FileCommentReaction.js +3 -3
  62. package/src/models/Folder.js +2 -2
  63. package/src/models/FormFieldSet.js +6 -4
  64. package/src/models/GpgKey.js +6 -4
  65. package/src/models/Group.js +6 -4
  66. package/src/models/GroupUser.js +6 -4
  67. package/src/models/HistoryExport.js +2 -2
  68. package/src/models/InboxRecipient.js +2 -2
  69. package/src/models/Lock.js +3 -3
  70. package/src/models/Message.js +6 -4
  71. package/src/models/MessageComment.js +6 -4
  72. package/src/models/MessageCommentReaction.js +3 -3
  73. package/src/models/MessageReaction.js +3 -3
  74. package/src/models/Notification.js +6 -4
  75. package/src/models/Permission.js +3 -3
  76. package/src/models/Project.js +6 -4
  77. package/src/models/PublicKey.js +6 -4
  78. package/src/models/RemoteServer.js +6 -4
  79. package/src/models/Request.js +3 -3
  80. package/src/models/Session.js +3 -3
  81. package/src/models/SftpHostKey.js +6 -4
  82. package/src/models/ShareGroup.js +6 -4
  83. package/src/models/Snapshot.js +6 -4
  84. package/src/models/SsoStrategy.js +1 -1
  85. package/src/models/Style.js +6 -3
  86. package/src/models/User.js +9 -7
  87. package/src/models/UserRequest.js +3 -3
  88. package/src/models/WebhookTest.js +2 -2
@@ -400,7 +400,7 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
400
400
  return _Api.default.sendRequest("/bundles/".concat(encodeURIComponent(params['id']), "/share"), 'POST', params, _this.options);
401
401
  case 22:
402
402
  response = _context.sent;
403
- return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
403
+ return _context.abrupt("return");
404
404
  case 24:
405
405
  case "end":
406
406
  return _context.stop();
@@ -608,7 +608,7 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
608
608
  return _Api.default.sendRequest("/bundles/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
609
609
  case 16:
610
610
  response = _context3.sent;
611
- return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
611
+ return _context3.abrupt("return");
612
612
  case 18:
613
613
  case "end":
614
614
  return _context3.stop();
@@ -619,19 +619,38 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
619
619
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
620
620
  return _this.delete(params);
621
621
  });
622
- (0, _defineProperty2.default)(this, "save", function () {
623
- if (_this.attributes['id']) {
624
- return _this.update(_this.attributes);
625
- } else {
626
- var newObject = Bundle.create(_this.attributes, _this.options);
627
- _this.attributes = _objectSpread({}, newObject.attributes);
628
- return true;
629
- }
630
- });
631
- Object.entries(attributes).forEach(function (_ref4) {
632
- var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
633
- key = _ref5[0],
634
- value = _ref5[1];
622
+ (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
623
+ var newObject, _newObject;
624
+ return _regenerator.default.wrap(function _callee4$(_context4) {
625
+ while (1) switch (_context4.prev = _context4.next) {
626
+ case 0:
627
+ if (!_this.attributes['id']) {
628
+ _context4.next = 8;
629
+ break;
630
+ }
631
+ _context4.next = 3;
632
+ return _this.update(_this.attributes);
633
+ case 3:
634
+ newObject = _context4.sent;
635
+ _this.attributes = _objectSpread({}, newObject.attributes);
636
+ return _context4.abrupt("return", true);
637
+ case 8:
638
+ _context4.next = 10;
639
+ return Bundle.create(_this.attributes, _this.options);
640
+ case 10:
641
+ _newObject = _context4.sent;
642
+ _this.attributes = _objectSpread({}, _newObject.attributes);
643
+ return _context4.abrupt("return", true);
644
+ case 13:
645
+ case "end":
646
+ return _context4.stop();
647
+ }
648
+ }, _callee4);
649
+ })));
650
+ Object.entries(attributes).forEach(function (_ref5) {
651
+ var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
652
+ key = _ref6[0],
653
+ value = _ref6[1];
635
654
  var normalizedKey = key.replace('?', '');
636
655
  _this.attributes[normalizedKey] = value;
637
656
  Object.defineProperty(_this, normalizedKey, {
@@ -652,47 +671,47 @@ _class = Bundle;
652
671
  // filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
653
672
  // filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
654
673
  // filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
655
- (0, _defineProperty2.default)(Bundle, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
674
+ (0, _defineProperty2.default)(Bundle, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
656
675
  var _response$data;
657
676
  var params,
658
677
  options,
659
678
  response,
660
- _args4 = arguments;
661
- return _regenerator.default.wrap(function _callee4$(_context4) {
662
- while (1) switch (_context4.prev = _context4.next) {
679
+ _args5 = arguments;
680
+ return _regenerator.default.wrap(function _callee5$(_context5) {
681
+ while (1) switch (_context5.prev = _context5.next) {
663
682
  case 0:
664
- params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
665
- options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
683
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
684
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
666
685
  if (!(params['user_id'] && !(0, _utils.isInt)(params['user_id']))) {
667
- _context4.next = 4;
686
+ _context5.next = 4;
668
687
  break;
669
688
  }
670
689
  throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params['user_id'])));
671
690
  case 4:
672
691
  if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
673
- _context4.next = 6;
692
+ _context5.next = 6;
674
693
  break;
675
694
  }
676
695
  throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
677
696
  case 6:
678
697
  if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
679
- _context4.next = 8;
698
+ _context5.next = 8;
680
699
  break;
681
700
  }
682
701
  throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
683
702
  case 8:
684
- _context4.next = 10;
703
+ _context5.next = 10;
685
704
  return _Api.default.sendRequest("/bundles", 'GET', params, options);
686
705
  case 10:
687
- response = _context4.sent;
688
- return _context4.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
706
+ response = _context5.sent;
707
+ return _context5.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
689
708
  return new _class(obj, options);
690
709
  })) || []);
691
710
  case 12:
692
711
  case "end":
693
- return _context4.stop();
712
+ return _context5.stop();
694
713
  }
695
- }, _callee4);
714
+ }, _callee5);
696
715
  })));
697
716
  (0, _defineProperty2.default)(Bundle, "all", function () {
698
717
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -702,48 +721,48 @@ _class = Bundle;
702
721
  // Parameters:
703
722
  // id (required) - int64 - Bundle ID.
704
723
  (0, _defineProperty2.default)(Bundle, "find", /*#__PURE__*/function () {
705
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
724
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(id) {
706
725
  var params,
707
726
  options,
708
727
  response,
709
- _args5 = arguments;
710
- return _regenerator.default.wrap(function _callee5$(_context5) {
711
- while (1) switch (_context5.prev = _context5.next) {
728
+ _args6 = arguments;
729
+ return _regenerator.default.wrap(function _callee6$(_context6) {
730
+ while (1) switch (_context6.prev = _context6.next) {
712
731
  case 0:
713
- params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
714
- options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
732
+ params = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
733
+ options = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
715
734
  if ((0, _utils.isObject)(params)) {
716
- _context5.next = 4;
735
+ _context6.next = 4;
717
736
  break;
718
737
  }
719
738
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
720
739
  case 4:
721
740
  params['id'] = id;
722
741
  if (params['id']) {
723
- _context5.next = 7;
742
+ _context6.next = 7;
724
743
  break;
725
744
  }
726
745
  throw new errors.MissingParameterError('Parameter missing: id');
727
746
  case 7:
728
747
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
729
- _context5.next = 9;
748
+ _context6.next = 9;
730
749
  break;
731
750
  }
732
751
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
733
752
  case 9:
734
- _context5.next = 11;
753
+ _context6.next = 11;
735
754
  return _Api.default.sendRequest("/bundles/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
736
755
  case 11:
737
- response = _context5.sent;
738
- return _context5.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
756
+ response = _context6.sent;
757
+ return _context6.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
739
758
  case 13:
740
759
  case "end":
741
- return _context5.stop();
760
+ return _context6.stop();
742
761
  }
743
- }, _callee5);
762
+ }, _callee6);
744
763
  }));
745
764
  return function (_x) {
746
- return _ref7.apply(this, arguments);
765
+ return _ref8.apply(this, arguments);
747
766
  };
748
767
  }());
749
768
  (0, _defineProperty2.default)(Bundle, "get", function (id) {
@@ -778,122 +797,122 @@ _class = Bundle;
778
797
  // start_access_on_date - string - Date when share will start to be accessible. If `nil` access granted right after create.
779
798
  // snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
780
799
  // watermark_attachment_file - file - Preview watermark image applied to all bundle items.
781
- (0, _defineProperty2.default)(Bundle, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
800
+ (0, _defineProperty2.default)(Bundle, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
782
801
  var params,
783
802
  options,
784
803
  response,
785
- _args6 = arguments;
786
- return _regenerator.default.wrap(function _callee6$(_context6) {
787
- while (1) switch (_context6.prev = _context6.next) {
804
+ _args7 = arguments;
805
+ return _regenerator.default.wrap(function _callee7$(_context7) {
806
+ while (1) switch (_context7.prev = _context7.next) {
788
807
  case 0:
789
- params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
790
- options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
808
+ params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
809
+ options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
791
810
  if (params['paths']) {
792
- _context6.next = 4;
811
+ _context7.next = 4;
793
812
  break;
794
813
  }
795
814
  throw new errors.MissingParameterError('Parameter missing: paths');
796
815
  case 4:
797
816
  if (!(params['user_id'] && !(0, _utils.isInt)(params['user_id']))) {
798
- _context6.next = 6;
817
+ _context7.next = 6;
799
818
  break;
800
819
  }
801
820
  throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params['user_id'])));
802
821
  case 6:
803
822
  if (!(params['paths'] && !(0, _utils.isArray)(params['paths']))) {
804
- _context6.next = 8;
823
+ _context7.next = 8;
805
824
  break;
806
825
  }
807
826
  throw new errors.InvalidParameterError("Bad parameter: paths must be of type Array, received ".concat((0, _utils.getType)(params['paths'])));
808
827
  case 8:
809
828
  if (!(params['password'] && !(0, _utils.isString)(params['password']))) {
810
- _context6.next = 10;
829
+ _context7.next = 10;
811
830
  break;
812
831
  }
813
832
  throw new errors.InvalidParameterError("Bad parameter: password must be of type String, received ".concat((0, _utils.getType)(params['password'])));
814
833
  case 10:
815
834
  if (!(params['form_field_set_id'] && !(0, _utils.isInt)(params['form_field_set_id']))) {
816
- _context6.next = 12;
835
+ _context7.next = 12;
817
836
  break;
818
837
  }
819
838
  throw new errors.InvalidParameterError("Bad parameter: form_field_set_id must be of type Int, received ".concat((0, _utils.getType)(params['form_field_set_id'])));
820
839
  case 12:
821
840
  if (!(params['expires_at'] && !(0, _utils.isString)(params['expires_at']))) {
822
- _context6.next = 14;
841
+ _context7.next = 14;
823
842
  break;
824
843
  }
825
844
  throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(params['expires_at'])));
826
845
  case 14:
827
846
  if (!(params['max_uses'] && !(0, _utils.isInt)(params['max_uses']))) {
828
- _context6.next = 16;
847
+ _context7.next = 16;
829
848
  break;
830
849
  }
831
850
  throw new errors.InvalidParameterError("Bad parameter: max_uses must be of type Int, received ".concat((0, _utils.getType)(params['max_uses'])));
832
851
  case 16:
833
852
  if (!(params['description'] && !(0, _utils.isString)(params['description']))) {
834
- _context6.next = 18;
853
+ _context7.next = 18;
835
854
  break;
836
855
  }
837
856
  throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(params['description'])));
838
857
  case 18:
839
858
  if (!(params['note'] && !(0, _utils.isString)(params['note']))) {
840
- _context6.next = 20;
859
+ _context7.next = 20;
841
860
  break;
842
861
  }
843
862
  throw new errors.InvalidParameterError("Bad parameter: note must be of type String, received ".concat((0, _utils.getType)(params['note'])));
844
863
  case 20:
845
864
  if (!(params['code'] && !(0, _utils.isString)(params['code']))) {
846
- _context6.next = 22;
865
+ _context7.next = 22;
847
866
  break;
848
867
  }
849
868
  throw new errors.InvalidParameterError("Bad parameter: code must be of type String, received ".concat((0, _utils.getType)(params['code'])));
850
869
  case 22:
851
870
  if (!(params['path_template'] && !(0, _utils.isString)(params['path_template']))) {
852
- _context6.next = 24;
871
+ _context7.next = 24;
853
872
  break;
854
873
  }
855
874
  throw new errors.InvalidParameterError("Bad parameter: path_template must be of type String, received ".concat((0, _utils.getType)(params['path_template'])));
856
875
  case 24:
857
876
  if (!(params['permissions'] && !(0, _utils.isString)(params['permissions']))) {
858
- _context6.next = 26;
877
+ _context7.next = 26;
859
878
  break;
860
879
  }
861
880
  throw new errors.InvalidParameterError("Bad parameter: permissions must be of type String, received ".concat((0, _utils.getType)(params['permissions'])));
862
881
  case 26:
863
882
  if (!(params['clickwrap_id'] && !(0, _utils.isInt)(params['clickwrap_id']))) {
864
- _context6.next = 28;
883
+ _context7.next = 28;
865
884
  break;
866
885
  }
867
886
  throw new errors.InvalidParameterError("Bad parameter: clickwrap_id must be of type Int, received ".concat((0, _utils.getType)(params['clickwrap_id'])));
868
887
  case 28:
869
888
  if (!(params['inbox_id'] && !(0, _utils.isInt)(params['inbox_id']))) {
870
- _context6.next = 30;
889
+ _context7.next = 30;
871
890
  break;
872
891
  }
873
892
  throw new errors.InvalidParameterError("Bad parameter: inbox_id must be of type Int, received ".concat((0, _utils.getType)(params['inbox_id'])));
874
893
  case 30:
875
894
  if (!(params['start_access_on_date'] && !(0, _utils.isString)(params['start_access_on_date']))) {
876
- _context6.next = 32;
895
+ _context7.next = 32;
877
896
  break;
878
897
  }
879
898
  throw new errors.InvalidParameterError("Bad parameter: start_access_on_date must be of type String, received ".concat((0, _utils.getType)(params['start_access_on_date'])));
880
899
  case 32:
881
900
  if (!(params['snapshot_id'] && !(0, _utils.isInt)(params['snapshot_id']))) {
882
- _context6.next = 34;
901
+ _context7.next = 34;
883
902
  break;
884
903
  }
885
904
  throw new errors.InvalidParameterError("Bad parameter: snapshot_id must be of type Int, received ".concat((0, _utils.getType)(params['snapshot_id'])));
886
905
  case 34:
887
- _context6.next = 36;
906
+ _context7.next = 36;
888
907
  return _Api.default.sendRequest("/bundles", 'POST', params, options);
889
908
  case 36:
890
- response = _context6.sent;
891
- return _context6.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
909
+ response = _context7.sent;
910
+ return _context7.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
892
911
  case 38:
893
912
  case "end":
894
- return _context6.stop();
913
+ return _context7.stop();
895
914
  }
896
- }, _callee6);
915
+ }, _callee7);
897
916
  })));
898
917
  var _default = exports.default = Bundle;
899
918
  module.exports = Bundle;
@@ -168,7 +168,7 @@ var BundleNotification = /*#__PURE__*/(0, _createClass2.default)(function Bundle
168
168
  return _Api.default.sendRequest("/bundle_notifications/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
169
169
  case 16:
170
170
  response = _context2.sent;
171
- return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
171
+ return _context2.abrupt("return");
172
172
  case 18:
173
173
  case "end":
174
174
  return _context2.stop();
@@ -179,19 +179,38 @@ var BundleNotification = /*#__PURE__*/(0, _createClass2.default)(function Bundle
179
179
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
180
180
  return _this.delete(params);
181
181
  });
182
- (0, _defineProperty2.default)(this, "save", function () {
183
- if (_this.attributes['id']) {
184
- return _this.update(_this.attributes);
185
- } else {
186
- var newObject = BundleNotification.create(_this.attributes, _this.options);
187
- _this.attributes = _objectSpread({}, newObject.attributes);
188
- return true;
189
- }
190
- });
191
- Object.entries(attributes).forEach(function (_ref3) {
192
- var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
193
- key = _ref4[0],
194
- value = _ref4[1];
182
+ (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
183
+ var newObject, _newObject;
184
+ return _regenerator.default.wrap(function _callee3$(_context3) {
185
+ while (1) switch (_context3.prev = _context3.next) {
186
+ case 0:
187
+ if (!_this.attributes['id']) {
188
+ _context3.next = 8;
189
+ break;
190
+ }
191
+ _context3.next = 3;
192
+ return _this.update(_this.attributes);
193
+ case 3:
194
+ newObject = _context3.sent;
195
+ _this.attributes = _objectSpread({}, newObject.attributes);
196
+ return _context3.abrupt("return", true);
197
+ case 8:
198
+ _context3.next = 10;
199
+ return BundleNotification.create(_this.attributes, _this.options);
200
+ case 10:
201
+ _newObject = _context3.sent;
202
+ _this.attributes = _objectSpread({}, _newObject.attributes);
203
+ return _context3.abrupt("return", true);
204
+ case 13:
205
+ case "end":
206
+ return _context3.stop();
207
+ }
208
+ }, _callee3);
209
+ })));
210
+ Object.entries(attributes).forEach(function (_ref4) {
211
+ var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
212
+ key = _ref5[0],
213
+ value = _ref5[1];
195
214
  var normalizedKey = key.replace('?', '');
196
215
  _this.attributes[normalizedKey] = value;
197
216
  Object.defineProperty(_this, normalizedKey, {
@@ -207,41 +226,41 @@ _class = BundleNotification;
207
226
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
208
227
  // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[bundle_id]=desc`). Valid fields are `bundle_id`.
209
228
  // filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `bundle_id`.
210
- (0, _defineProperty2.default)(BundleNotification, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
229
+ (0, _defineProperty2.default)(BundleNotification, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
211
230
  var _response$data;
212
231
  var params,
213
232
  options,
214
233
  response,
215
- _args3 = arguments;
216
- return _regenerator.default.wrap(function _callee3$(_context3) {
217
- while (1) switch (_context3.prev = _context3.next) {
234
+ _args4 = arguments;
235
+ return _regenerator.default.wrap(function _callee4$(_context4) {
236
+ while (1) switch (_context4.prev = _context4.next) {
218
237
  case 0:
219
- params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
220
- options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
238
+ params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
239
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
221
240
  if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
222
- _context3.next = 4;
241
+ _context4.next = 4;
223
242
  break;
224
243
  }
225
244
  throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
226
245
  case 4:
227
246
  if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
228
- _context3.next = 6;
247
+ _context4.next = 6;
229
248
  break;
230
249
  }
231
250
  throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
232
251
  case 6:
233
- _context3.next = 8;
252
+ _context4.next = 8;
234
253
  return _Api.default.sendRequest("/bundle_notifications", 'GET', params, options);
235
254
  case 8:
236
- response = _context3.sent;
237
- return _context3.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
255
+ response = _context4.sent;
256
+ return _context4.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
238
257
  return new _class(obj, options);
239
258
  })) || []);
240
259
  case 10:
241
260
  case "end":
242
- return _context3.stop();
261
+ return _context4.stop();
243
262
  }
244
- }, _callee3);
263
+ }, _callee4);
245
264
  })));
246
265
  (0, _defineProperty2.default)(BundleNotification, "all", function () {
247
266
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -251,48 +270,48 @@ _class = BundleNotification;
251
270
  // Parameters:
252
271
  // id (required) - int64 - Bundle Notification ID.
253
272
  (0, _defineProperty2.default)(BundleNotification, "find", /*#__PURE__*/function () {
254
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(id) {
273
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
255
274
  var params,
256
275
  options,
257
276
  response,
258
- _args4 = arguments;
259
- return _regenerator.default.wrap(function _callee4$(_context4) {
260
- while (1) switch (_context4.prev = _context4.next) {
277
+ _args5 = arguments;
278
+ return _regenerator.default.wrap(function _callee5$(_context5) {
279
+ while (1) switch (_context5.prev = _context5.next) {
261
280
  case 0:
262
- params = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
263
- options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
281
+ params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
282
+ options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
264
283
  if ((0, _utils.isObject)(params)) {
265
- _context4.next = 4;
284
+ _context5.next = 4;
266
285
  break;
267
286
  }
268
287
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
269
288
  case 4:
270
289
  params['id'] = id;
271
290
  if (params['id']) {
272
- _context4.next = 7;
291
+ _context5.next = 7;
273
292
  break;
274
293
  }
275
294
  throw new errors.MissingParameterError('Parameter missing: id');
276
295
  case 7:
277
296
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
278
- _context4.next = 9;
297
+ _context5.next = 9;
279
298
  break;
280
299
  }
281
300
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
282
301
  case 9:
283
- _context4.next = 11;
302
+ _context5.next = 11;
284
303
  return _Api.default.sendRequest("/bundle_notifications/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
285
304
  case 11:
286
- response = _context4.sent;
287
- return _context4.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
305
+ response = _context5.sent;
306
+ return _context5.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
288
307
  case 13:
289
308
  case "end":
290
- return _context4.stop();
309
+ return _context5.stop();
291
310
  }
292
- }, _callee4);
311
+ }, _callee5);
293
312
  }));
294
313
  return function (_x) {
295
- return _ref6.apply(this, arguments);
314
+ return _ref7.apply(this, arguments);
296
315
  };
297
316
  }());
298
317
  (0, _defineProperty2.default)(BundleNotification, "get", function (id) {
@@ -305,44 +324,44 @@ _class = BundleNotification;
305
324
  // notify_on_upload - boolean - Triggers bundle notification when a upload action occurs for it.
306
325
  // bundle_id (required) - int64 - Bundle ID to notify on
307
326
  // user_id - int64 - The id of the user to notify.
308
- (0, _defineProperty2.default)(BundleNotification, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
327
+ (0, _defineProperty2.default)(BundleNotification, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
309
328
  var params,
310
329
  options,
311
330
  response,
312
- _args5 = arguments;
313
- return _regenerator.default.wrap(function _callee5$(_context5) {
314
- while (1) switch (_context5.prev = _context5.next) {
331
+ _args6 = arguments;
332
+ return _regenerator.default.wrap(function _callee6$(_context6) {
333
+ while (1) switch (_context6.prev = _context6.next) {
315
334
  case 0:
316
- params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
317
- options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
335
+ params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
336
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
318
337
  if (params['bundle_id']) {
319
- _context5.next = 4;
338
+ _context6.next = 4;
320
339
  break;
321
340
  }
322
341
  throw new errors.MissingParameterError('Parameter missing: bundle_id');
323
342
  case 4:
324
343
  if (!(params['bundle_id'] && !(0, _utils.isInt)(params['bundle_id']))) {
325
- _context5.next = 6;
344
+ _context6.next = 6;
326
345
  break;
327
346
  }
328
347
  throw new errors.InvalidParameterError("Bad parameter: bundle_id must be of type Int, received ".concat((0, _utils.getType)(params['bundle_id'])));
329
348
  case 6:
330
349
  if (!(params['user_id'] && !(0, _utils.isInt)(params['user_id']))) {
331
- _context5.next = 8;
350
+ _context6.next = 8;
332
351
  break;
333
352
  }
334
353
  throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params['user_id'])));
335
354
  case 8:
336
- _context5.next = 10;
355
+ _context6.next = 10;
337
356
  return _Api.default.sendRequest("/bundle_notifications", 'POST', params, options);
338
357
  case 10:
339
- response = _context5.sent;
340
- return _context5.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
358
+ response = _context6.sent;
359
+ return _context6.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
341
360
  case 12:
342
361
  case "end":
343
- return _context5.stop();
362
+ return _context6.stop();
344
363
  }
345
- }, _callee5);
364
+ }, _callee6);
346
365
  })));
347
366
  var _default = exports.default = BundleNotification;
348
367
  module.exports = BundleNotification;