files.com 1.0.474 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/lib/Files.js +1 -1
- package/lib/models/ActionNotificationExport.js +63 -49
- package/lib/models/ActionWebhookFailure.js +1 -1
- package/lib/models/ApiKey.js +113 -94
- package/lib/models/As2Partner.js +81 -62
- package/lib/models/As2Station.js +79 -60
- package/lib/models/Automation.js +90 -71
- package/lib/models/Behavior.js +114 -95
- package/lib/models/Bundle.js +90 -71
- package/lib/models/BundleNotification.js +75 -56
- package/lib/models/BundleRecipient.js +61 -47
- package/lib/models/Clickwrap.js +77 -58
- package/lib/models/ExternalEvent.js +71 -57
- package/lib/models/File.js +166 -154
- package/lib/models/FileComment.js +65 -46
- package/lib/models/FileCommentReaction.js +44 -30
- package/lib/models/Folder.js +58 -46
- package/lib/models/FormFieldSet.js +76 -57
- package/lib/models/GpgKey.js +79 -60
- package/lib/models/Group.js +78 -59
- package/lib/models/GroupUser.js +63 -44
- package/lib/models/HistoryExport.js +76 -62
- package/lib/models/InboxRecipient.js +61 -47
- package/lib/models/Lock.js +56 -44
- package/lib/models/Message.js +82 -63
- package/lib/models/MessageComment.js +78 -59
- package/lib/models/MessageCommentReaction.js +73 -59
- package/lib/models/MessageReaction.js +73 -59
- package/lib/models/Notification.js +84 -65
- package/lib/models/Permission.js +60 -46
- package/lib/models/Project.js +74 -55
- package/lib/models/PublicKey.js +78 -59
- package/lib/models/RemoteServer.js +147 -128
- package/lib/models/Request.js +76 -62
- package/lib/models/Session.js +53 -39
- package/lib/models/SftpHostKey.js +74 -55
- package/lib/models/ShareGroup.js +79 -60
- package/lib/models/Snapshot.js +75 -56
- package/lib/models/SsoStrategy.js +1 -1
- package/lib/models/Style.js +37 -23
- package/lib/models/User.js +104 -85
- package/lib/models/UserRequest.js +73 -59
- package/lib/models/WebhookTest.js +46 -32
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/ActionNotificationExport.js +2 -2
- package/src/models/ActionWebhookFailure.js +1 -1
- package/src/models/ApiKey.js +7 -5
- package/src/models/As2Partner.js +6 -4
- package/src/models/As2Station.js +6 -4
- package/src/models/Automation.js +7 -5
- package/src/models/Behavior.js +7 -5
- package/src/models/Bundle.js +7 -5
- package/src/models/BundleNotification.js +6 -4
- package/src/models/BundleRecipient.js +2 -2
- package/src/models/Clickwrap.js +6 -4
- package/src/models/ExternalEvent.js +2 -2
- package/src/models/File.js +3 -3
- package/src/models/FileComment.js +6 -4
- package/src/models/FileCommentReaction.js +3 -3
- package/src/models/Folder.js +2 -2
- package/src/models/FormFieldSet.js +6 -4
- package/src/models/GpgKey.js +6 -4
- package/src/models/Group.js +6 -4
- package/src/models/GroupUser.js +6 -4
- package/src/models/HistoryExport.js +2 -2
- package/src/models/InboxRecipient.js +2 -2
- package/src/models/Lock.js +3 -3
- package/src/models/Message.js +6 -4
- package/src/models/MessageComment.js +6 -4
- package/src/models/MessageCommentReaction.js +3 -3
- package/src/models/MessageReaction.js +3 -3
- package/src/models/Notification.js +6 -4
- package/src/models/Permission.js +3 -3
- package/src/models/Project.js +6 -4
- package/src/models/PublicKey.js +6 -4
- package/src/models/RemoteServer.js +6 -4
- package/src/models/Request.js +3 -3
- package/src/models/Session.js +3 -3
- package/src/models/SftpHostKey.js +6 -4
- package/src/models/ShareGroup.js +6 -4
- package/src/models/Snapshot.js +6 -4
- package/src/models/SsoStrategy.js +1 -1
- package/src/models/Style.js +6 -3
- package/src/models/User.js +9 -7
- package/src/models/UserRequest.js +3 -3
- package/src/models/WebhookTest.js +2 -2
package/lib/models/Bundle.js
CHANGED
@@ -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"
|
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"
|
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
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
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
|
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
|
-
|
661
|
-
return _regenerator.default.wrap(function
|
662
|
-
while (1) switch (
|
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 =
|
665
|
-
options =
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
703
|
+
_context5.next = 10;
|
685
704
|
return _Api.default.sendRequest("/bundles", 'GET', params, options);
|
686
705
|
case 10:
|
687
|
-
response =
|
688
|
-
return
|
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
|
712
|
+
return _context5.stop();
|
694
713
|
}
|
695
|
-
},
|
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
|
724
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(id) {
|
706
725
|
var params,
|
707
726
|
options,
|
708
727
|
response,
|
709
|
-
|
710
|
-
return _regenerator.default.wrap(function
|
711
|
-
while (1) switch (
|
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 =
|
714
|
-
options =
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
753
|
+
_context6.next = 11;
|
735
754
|
return _Api.default.sendRequest("/bundles/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
|
736
755
|
case 11:
|
737
|
-
response =
|
738
|
-
return
|
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
|
760
|
+
return _context6.stop();
|
742
761
|
}
|
743
|
-
},
|
762
|
+
}, _callee6);
|
744
763
|
}));
|
745
764
|
return function (_x) {
|
746
|
-
return
|
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
|
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
|
-
|
786
|
-
return _regenerator.default.wrap(function
|
787
|
-
while (1) switch (
|
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 =
|
790
|
-
options =
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
906
|
+
_context7.next = 36;
|
888
907
|
return _Api.default.sendRequest("/bundles", 'POST', params, options);
|
889
908
|
case 36:
|
890
|
-
response =
|
891
|
-
return
|
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
|
913
|
+
return _context7.stop();
|
895
914
|
}
|
896
|
-
},
|
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"
|
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
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
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
|
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
|
-
|
216
|
-
return _regenerator.default.wrap(function
|
217
|
-
while (1) switch (
|
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 =
|
220
|
-
options =
|
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
|
-
|
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
|
-
|
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
|
-
|
252
|
+
_context4.next = 8;
|
234
253
|
return _Api.default.sendRequest("/bundle_notifications", 'GET', params, options);
|
235
254
|
case 8:
|
236
|
-
response =
|
237
|
-
return
|
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
|
261
|
+
return _context4.stop();
|
243
262
|
}
|
244
|
-
},
|
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
|
273
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
|
255
274
|
var params,
|
256
275
|
options,
|
257
276
|
response,
|
258
|
-
|
259
|
-
return _regenerator.default.wrap(function
|
260
|
-
while (1) switch (
|
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 =
|
263
|
-
options =
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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 =
|
287
|
-
return
|
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
|
309
|
+
return _context5.stop();
|
291
310
|
}
|
292
|
-
},
|
311
|
+
}, _callee5);
|
293
312
|
}));
|
294
313
|
return function (_x) {
|
295
|
-
return
|
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
|
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
|
-
|
313
|
-
return _regenerator.default.wrap(function
|
314
|
-
while (1) switch (
|
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 =
|
317
|
-
options =
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
355
|
+
_context6.next = 10;
|
337
356
|
return _Api.default.sendRequest("/bundle_notifications", 'POST', params, options);
|
338
357
|
case 10:
|
339
|
-
response =
|
340
|
-
return
|
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
|
362
|
+
return _context6.stop();
|
344
363
|
}
|
345
|
-
},
|
364
|
+
}, _callee6);
|
346
365
|
})));
|
347
366
|
var _default = exports.default = BundleNotification;
|
348
367
|
module.exports = BundleNotification;
|