files.com 1.0.236 → 1.0.238
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/docs/Errors.md +1 -0
- package/docs/models/BundleNotification.md +35 -0
- package/lib/Api.js +153 -159
- package/lib/Errors.js +680 -666
- package/lib/isomorphic/File.node.js +24 -28
- package/lib/models/ActionNotificationExport.js +97 -101
- package/lib/models/ActionNotificationExportResult.js +44 -46
- package/lib/models/ActionWebhookFailure.js +42 -44
- package/lib/models/ApiKey.js +271 -287
- package/lib/models/App.js +26 -28
- package/lib/models/As2IncomingMessage.js +32 -34
- package/lib/models/As2OutgoingMessage.js +32 -34
- package/lib/models/As2Partner.js +231 -241
- package/lib/models/As2Station.js +219 -229
- package/lib/models/Automation.js +333 -343
- package/lib/models/AutomationRun.js +75 -79
- package/lib/models/BandwidthSnapshot.js +26 -28
- package/lib/models/Behavior.js +323 -337
- package/lib/models/Bundle.js +375 -387
- package/lib/models/BundleDownload.js +38 -40
- package/lib/models/BundleNotification.js +223 -173
- package/lib/models/BundleRecipient.js +104 -108
- package/lib/models/BundleRegistration.js +38 -40
- package/lib/models/Clickwrap.js +213 -223
- package/lib/models/DnsRecord.js +26 -28
- package/lib/models/ExternalEvent.js +93 -99
- package/lib/models/File.js +726 -766
- package/lib/models/FileComment.js +180 -188
- package/lib/models/FileCommentReaction.js +84 -88
- package/lib/models/FileMigration.js +31 -33
- package/lib/models/Folder.js +94 -98
- package/lib/models/FormFieldSet.js +189 -199
- package/lib/models/Group.js +207 -217
- package/lib/models/GroupUser.js +230 -238
- package/lib/models/History.js +266 -276
- package/lib/models/HistoryExport.js +175 -179
- package/lib/models/HistoryExportResult.js +44 -46
- package/lib/models/InboxRecipient.js +104 -108
- package/lib/models/InboxRegistration.js +32 -34
- package/lib/models/InboxUpload.js +38 -40
- package/lib/models/Invoice.js +57 -61
- package/lib/models/IpAddress.js +78 -84
- package/lib/models/Lock.js +148 -154
- package/lib/models/Message.js +267 -277
- package/lib/models/MessageComment.js +207 -217
- package/lib/models/MessageCommentReaction.js +147 -155
- package/lib/models/MessageReaction.js +147 -155
- package/lib/models/Notification.js +255 -265
- package/lib/models/Payment.js +57 -61
- package/lib/models/Permission.js +128 -134
- package/lib/models/Priority.js +45 -47
- package/lib/models/Project.js +183 -193
- package/lib/models/PublicKey.js +207 -217
- package/lib/models/RemoteBandwidthSnapshot.js +26 -28
- package/lib/models/RemoteServer.js +805 -819
- package/lib/models/Request.js +166 -174
- package/lib/models/Session.js +47 -51
- package/lib/models/SettingsChange.js +26 -28
- package/lib/models/SftpHostKey.js +177 -187
- package/lib/models/Site.js +412 -418
- package/lib/models/SsoStrategy.js +99 -105
- package/lib/models/Style.js +127 -133
- package/lib/models/UsageDailySnapshot.js +26 -28
- package/lib/models/UsageSnapshot.js +26 -28
- package/lib/models/User.js +587 -603
- package/lib/models/UserCipherUse.js +32 -34
- package/lib/models/UserRequest.js +147 -155
- package/lib/models/WebhookTest.js +54 -56
- package/package.json +1 -1
- package/src/Errors.js +1 -0
- package/src/models/BundleNotification.js +39 -1
package/lib/models/User.js
CHANGED
@@ -447,52 +447,50 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
|
|
447
447
|
response,
|
448
448
|
_args = arguments;
|
449
449
|
return _regenerator.default.wrap(function _callee$(_context) {
|
450
|
-
while (1) {
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
if (params['id']) {
|
474
|
-
_context.next = 14;
|
475
|
-
break;
|
476
|
-
}
|
477
|
-
if (!_this.attributes.id) {
|
478
|
-
_context.next = 13;
|
479
|
-
break;
|
480
|
-
}
|
481
|
-
params['id'] = _this.id;
|
450
|
+
while (1) switch (_context.prev = _context.next) {
|
451
|
+
case 0:
|
452
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
453
|
+
if (_this.attributes.id) {
|
454
|
+
_context.next = 3;
|
455
|
+
break;
|
456
|
+
}
|
457
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
458
|
+
case 3:
|
459
|
+
if ((0, _utils.isObject)(params)) {
|
460
|
+
_context.next = 5;
|
461
|
+
break;
|
462
|
+
}
|
463
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
464
|
+
case 5:
|
465
|
+
params.id = _this.attributes.id;
|
466
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
467
|
+
_context.next = 8;
|
468
|
+
break;
|
469
|
+
}
|
470
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
471
|
+
case 8:
|
472
|
+
if (params['id']) {
|
482
473
|
_context.next = 14;
|
483
474
|
break;
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
475
|
+
}
|
476
|
+
if (!_this.attributes.id) {
|
477
|
+
_context.next = 13;
|
478
|
+
break;
|
479
|
+
}
|
480
|
+
params['id'] = _this.id;
|
481
|
+
_context.next = 14;
|
482
|
+
break;
|
483
|
+
case 13:
|
484
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
485
|
+
case 14:
|
486
|
+
_context.next = 16;
|
487
|
+
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id']), "/unlock"), 'POST', params, _this.options);
|
488
|
+
case 16:
|
489
|
+
response = _context.sent;
|
490
|
+
return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
491
|
+
case 18:
|
492
|
+
case "end":
|
493
|
+
return _context.stop();
|
496
494
|
}
|
497
495
|
}, _callee);
|
498
496
|
})));
|
@@ -501,52 +499,50 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
|
|
501
499
|
response,
|
502
500
|
_args2 = arguments;
|
503
501
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
504
|
-
while (1) {
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
if (params['id']) {
|
528
|
-
_context2.next = 14;
|
529
|
-
break;
|
530
|
-
}
|
531
|
-
if (!_this.attributes.id) {
|
532
|
-
_context2.next = 13;
|
533
|
-
break;
|
534
|
-
}
|
535
|
-
params['id'] = _this.id;
|
502
|
+
while (1) switch (_context2.prev = _context2.next) {
|
503
|
+
case 0:
|
504
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
505
|
+
if (_this.attributes.id) {
|
506
|
+
_context2.next = 3;
|
507
|
+
break;
|
508
|
+
}
|
509
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
510
|
+
case 3:
|
511
|
+
if ((0, _utils.isObject)(params)) {
|
512
|
+
_context2.next = 5;
|
513
|
+
break;
|
514
|
+
}
|
515
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
516
|
+
case 5:
|
517
|
+
params.id = _this.attributes.id;
|
518
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
519
|
+
_context2.next = 8;
|
520
|
+
break;
|
521
|
+
}
|
522
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
523
|
+
case 8:
|
524
|
+
if (params['id']) {
|
536
525
|
_context2.next = 14;
|
537
526
|
break;
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
527
|
+
}
|
528
|
+
if (!_this.attributes.id) {
|
529
|
+
_context2.next = 13;
|
530
|
+
break;
|
531
|
+
}
|
532
|
+
params['id'] = _this.id;
|
533
|
+
_context2.next = 14;
|
534
|
+
break;
|
535
|
+
case 13:
|
536
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
537
|
+
case 14:
|
538
|
+
_context2.next = 16;
|
539
|
+
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id']), "/resend_welcome_email"), 'POST', params, _this.options);
|
540
|
+
case 16:
|
541
|
+
response = _context2.sent;
|
542
|
+
return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
543
|
+
case 18:
|
544
|
+
case "end":
|
545
|
+
return _context2.stop();
|
550
546
|
}
|
551
547
|
}, _callee2);
|
552
548
|
})));
|
@@ -555,52 +551,50 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
|
|
555
551
|
response,
|
556
552
|
_args3 = arguments;
|
557
553
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
558
|
-
while (1) {
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
if (params['id']) {
|
582
|
-
_context3.next = 14;
|
583
|
-
break;
|
584
|
-
}
|
585
|
-
if (!_this.attributes.id) {
|
586
|
-
_context3.next = 13;
|
587
|
-
break;
|
588
|
-
}
|
589
|
-
params['id'] = _this.id;
|
554
|
+
while (1) switch (_context3.prev = _context3.next) {
|
555
|
+
case 0:
|
556
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
557
|
+
if (_this.attributes.id) {
|
558
|
+
_context3.next = 3;
|
559
|
+
break;
|
560
|
+
}
|
561
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
562
|
+
case 3:
|
563
|
+
if ((0, _utils.isObject)(params)) {
|
564
|
+
_context3.next = 5;
|
565
|
+
break;
|
566
|
+
}
|
567
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
568
|
+
case 5:
|
569
|
+
params.id = _this.attributes.id;
|
570
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
571
|
+
_context3.next = 8;
|
572
|
+
break;
|
573
|
+
}
|
574
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
575
|
+
case 8:
|
576
|
+
if (params['id']) {
|
590
577
|
_context3.next = 14;
|
591
578
|
break;
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
579
|
+
}
|
580
|
+
if (!_this.attributes.id) {
|
581
|
+
_context3.next = 13;
|
582
|
+
break;
|
583
|
+
}
|
584
|
+
params['id'] = _this.id;
|
585
|
+
_context3.next = 14;
|
586
|
+
break;
|
587
|
+
case 13:
|
588
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
589
|
+
case 14:
|
590
|
+
_context3.next = 16;
|
591
|
+
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id']), "/2fa/reset"), 'POST', params, _this.options);
|
592
|
+
case 16:
|
593
|
+
response = _context3.sent;
|
594
|
+
return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
595
|
+
case 18:
|
596
|
+
case "end":
|
597
|
+
return _context3.stop();
|
604
598
|
}
|
605
599
|
}, _callee3);
|
606
600
|
})));
|
@@ -609,562 +603,552 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
|
|
609
603
|
response,
|
610
604
|
_args4 = arguments;
|
611
605
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
612
|
-
while (1) {
|
613
|
-
switch (_context4.prev = _context4.next) {
|
614
|
-
case 0:
|
615
|
-
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
616
|
-
if (_this.attributes.id) {
|
617
|
-
_context4.next = 3;
|
618
|
-
break;
|
619
|
-
}
|
620
|
-
throw new errors.EmptyPropertyError('Current object has no id');
|
621
|
-
case 3:
|
622
|
-
if ((0, _utils.isObject)(params)) {
|
623
|
-
_context4.next = 5;
|
624
|
-
break;
|
625
|
-
}
|
626
|
-
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
627
|
-
case 5:
|
628
|
-
params.id = _this.attributes.id;
|
629
|
-
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
630
|
-
_context4.next = 8;
|
631
|
-
break;
|
632
|
-
}
|
633
|
-
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
634
|
-
case 8:
|
635
|
-
if (!(params['change_password'] && !(0, _utils.isString)(params['change_password']))) {
|
636
|
-
_context4.next = 10;
|
637
|
-
break;
|
638
|
-
}
|
639
|
-
throw new errors.InvalidParameterError("Bad parameter: change_password must be of type String, received ".concat((0, _utils.getType)(change_password)));
|
640
|
-
case 10:
|
641
|
-
if (!(params['change_password_confirmation'] && !(0, _utils.isString)(params['change_password_confirmation']))) {
|
642
|
-
_context4.next = 12;
|
643
|
-
break;
|
644
|
-
}
|
645
|
-
throw new errors.InvalidParameterError("Bad parameter: change_password_confirmation must be of type String, received ".concat((0, _utils.getType)(change_password_confirmation)));
|
646
|
-
case 12:
|
647
|
-
if (!(params['email'] && !(0, _utils.isString)(params['email']))) {
|
648
|
-
_context4.next = 14;
|
649
|
-
break;
|
650
|
-
}
|
651
|
-
throw new errors.InvalidParameterError("Bad parameter: email must be of type String, received ".concat((0, _utils.getType)(email)));
|
652
|
-
case 14:
|
653
|
-
if (!(params['grant_permission'] && !(0, _utils.isString)(params['grant_permission']))) {
|
654
|
-
_context4.next = 16;
|
655
|
-
break;
|
656
|
-
}
|
657
|
-
throw new errors.InvalidParameterError("Bad parameter: grant_permission must be of type String, received ".concat((0, _utils.getType)(grant_permission)));
|
658
|
-
case 16:
|
659
|
-
if (!(params['group_id'] && !(0, _utils.isInt)(params['group_id']))) {
|
660
|
-
_context4.next = 18;
|
661
|
-
break;
|
662
|
-
}
|
663
|
-
throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(group_id)));
|
664
|
-
case 18:
|
665
|
-
if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
|
666
|
-
_context4.next = 20;
|
667
|
-
break;
|
668
|
-
}
|
669
|
-
throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(group_ids)));
|
670
|
-
case 20:
|
671
|
-
if (!(params['imported_password_hash'] && !(0, _utils.isString)(params['imported_password_hash']))) {
|
672
|
-
_context4.next = 22;
|
673
|
-
break;
|
674
|
-
}
|
675
|
-
throw new errors.InvalidParameterError("Bad parameter: imported_password_hash must be of type String, received ".concat((0, _utils.getType)(imported_password_hash)));
|
676
|
-
case 22:
|
677
|
-
if (!(params['password'] && !(0, _utils.isString)(params['password']))) {
|
678
|
-
_context4.next = 24;
|
679
|
-
break;
|
680
|
-
}
|
681
|
-
throw new errors.InvalidParameterError("Bad parameter: password must be of type String, received ".concat((0, _utils.getType)(password)));
|
682
|
-
case 24:
|
683
|
-
if (!(params['password_confirmation'] && !(0, _utils.isString)(params['password_confirmation']))) {
|
684
|
-
_context4.next = 26;
|
685
|
-
break;
|
686
|
-
}
|
687
|
-
throw new errors.InvalidParameterError("Bad parameter: password_confirmation must be of type String, received ".concat((0, _utils.getType)(password_confirmation)));
|
688
|
-
case 26:
|
689
|
-
if (!(params['allowed_ips'] && !(0, _utils.isString)(params['allowed_ips']))) {
|
690
|
-
_context4.next = 28;
|
691
|
-
break;
|
692
|
-
}
|
693
|
-
throw new errors.InvalidParameterError("Bad parameter: allowed_ips must be of type String, received ".concat((0, _utils.getType)(allowed_ips)));
|
694
|
-
case 28:
|
695
|
-
if (!(params['authenticate_until'] && !(0, _utils.isString)(params['authenticate_until']))) {
|
696
|
-
_context4.next = 30;
|
697
|
-
break;
|
698
|
-
}
|
699
|
-
throw new errors.InvalidParameterError("Bad parameter: authenticate_until must be of type String, received ".concat((0, _utils.getType)(authenticate_until)));
|
700
|
-
case 30:
|
701
|
-
if (!(params['authentication_method'] && !(0, _utils.isString)(params['authentication_method']))) {
|
702
|
-
_context4.next = 32;
|
703
|
-
break;
|
704
|
-
}
|
705
|
-
throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(authentication_method)));
|
706
|
-
case 32:
|
707
|
-
if (!(params['header_text'] && !(0, _utils.isString)(params['header_text']))) {
|
708
|
-
_context4.next = 34;
|
709
|
-
break;
|
710
|
-
}
|
711
|
-
throw new errors.InvalidParameterError("Bad parameter: header_text must be of type String, received ".concat((0, _utils.getType)(header_text)));
|
712
|
-
case 34:
|
713
|
-
if (!(params['language'] && !(0, _utils.isString)(params['language']))) {
|
714
|
-
_context4.next = 36;
|
715
|
-
break;
|
716
|
-
}
|
717
|
-
throw new errors.InvalidParameterError("Bad parameter: language must be of type String, received ".concat((0, _utils.getType)(language)));
|
718
|
-
case 36:
|
719
|
-
if (!(params['notification_daily_send_time'] && !(0, _utils.isInt)(params['notification_daily_send_time']))) {
|
720
|
-
_context4.next = 38;
|
721
|
-
break;
|
722
|
-
}
|
723
|
-
throw new errors.InvalidParameterError("Bad parameter: notification_daily_send_time must be of type Int, received ".concat((0, _utils.getType)(notification_daily_send_time)));
|
724
|
-
case 38:
|
725
|
-
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
726
|
-
_context4.next = 40;
|
727
|
-
break;
|
728
|
-
}
|
729
|
-
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
730
|
-
case 40:
|
731
|
-
if (!(params['company'] && !(0, _utils.isString)(params['company']))) {
|
732
|
-
_context4.next = 42;
|
733
|
-
break;
|
734
|
-
}
|
735
|
-
throw new errors.InvalidParameterError("Bad parameter: company must be of type String, received ".concat((0, _utils.getType)(company)));
|
736
|
-
case 42:
|
737
|
-
if (!(params['notes'] && !(0, _utils.isString)(params['notes']))) {
|
738
|
-
_context4.next = 44;
|
739
|
-
break;
|
740
|
-
}
|
741
|
-
throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(notes)));
|
742
|
-
case 44:
|
743
|
-
if (!(params['password_validity_days'] && !(0, _utils.isInt)(params['password_validity_days']))) {
|
744
|
-
_context4.next = 46;
|
745
|
-
break;
|
746
|
-
}
|
747
|
-
throw new errors.InvalidParameterError("Bad parameter: password_validity_days must be of type Int, received ".concat((0, _utils.getType)(password_validity_days)));
|
748
|
-
case 46:
|
749
|
-
if (!(params['ssl_required'] && !(0, _utils.isString)(params['ssl_required']))) {
|
750
|
-
_context4.next = 48;
|
751
|
-
break;
|
752
|
-
}
|
753
|
-
throw new errors.InvalidParameterError("Bad parameter: ssl_required must be of type String, received ".concat((0, _utils.getType)(ssl_required)));
|
754
|
-
case 48:
|
755
|
-
if (!(params['sso_strategy_id'] && !(0, _utils.isInt)(params['sso_strategy_id']))) {
|
756
|
-
_context4.next = 50;
|
757
|
-
break;
|
758
|
-
}
|
759
|
-
throw new errors.InvalidParameterError("Bad parameter: sso_strategy_id must be of type Int, received ".concat((0, _utils.getType)(sso_strategy_id)));
|
760
|
-
case 50:
|
761
|
-
if (!(params['require_2fa'] && !(0, _utils.isString)(params['require_2fa']))) {
|
762
|
-
_context4.next = 52;
|
763
|
-
break;
|
764
|
-
}
|
765
|
-
throw new errors.InvalidParameterError("Bad parameter: require_2fa must be of type String, received ".concat((0, _utils.getType)(require_2fa)));
|
766
|
-
case 52:
|
767
|
-
if (!(params['time_zone'] && !(0, _utils.isString)(params['time_zone']))) {
|
768
|
-
_context4.next = 54;
|
769
|
-
break;
|
770
|
-
}
|
771
|
-
throw new errors.InvalidParameterError("Bad parameter: time_zone must be of type String, received ".concat((0, _utils.getType)(time_zone)));
|
772
|
-
case 54:
|
773
|
-
if (!(params['user_root'] && !(0, _utils.isString)(params['user_root']))) {
|
774
|
-
_context4.next = 56;
|
775
|
-
break;
|
776
|
-
}
|
777
|
-
throw new errors.InvalidParameterError("Bad parameter: user_root must be of type String, received ".concat((0, _utils.getType)(user_root)));
|
778
|
-
case 56:
|
779
|
-
if (!(params['username'] && !(0, _utils.isString)(params['username']))) {
|
780
|
-
_context4.next = 58;
|
781
|
-
break;
|
782
|
-
}
|
783
|
-
throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(username)));
|
784
|
-
case 58:
|
785
|
-
if (params['id']) {
|
786
|
-
_context4.next = 64;
|
787
|
-
break;
|
788
|
-
}
|
789
|
-
if (!_this.attributes.id) {
|
790
|
-
_context4.next = 63;
|
791
|
-
break;
|
792
|
-
}
|
793
|
-
params['id'] = _this.id;
|
794
|
-
_context4.next = 64;
|
795
|
-
break;
|
796
|
-
case 63:
|
797
|
-
throw new errors.MissingParameterError('Parameter missing: id');
|
798
|
-
case 64:
|
799
|
-
_context4.next = 66;
|
800
|
-
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
|
801
|
-
case 66:
|
802
|
-
response = _context4.sent;
|
803
|
-
return _context4.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
804
|
-
case 68:
|
805
|
-
case "end":
|
806
|
-
return _context4.stop();
|
807
|
-
}
|
808
|
-
}
|
809
|
-
}, _callee4);
|
810
|
-
})));
|
811
|
-
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
812
|
-
var params,
|
813
|
-
response,
|
814
|
-
_args5 = arguments;
|
815
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
816
|
-
while (1) {
|
817
|
-
switch (_context5.prev = _context5.next) {
|
818
|
-
case 0:
|
819
|
-
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
820
|
-
if (_this.attributes.id) {
|
821
|
-
_context5.next = 3;
|
822
|
-
break;
|
823
|
-
}
|
824
|
-
throw new errors.EmptyPropertyError('Current object has no id');
|
825
|
-
case 3:
|
826
|
-
if ((0, _utils.isObject)(params)) {
|
827
|
-
_context5.next = 5;
|
828
|
-
break;
|
829
|
-
}
|
830
|
-
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
831
|
-
case 5:
|
832
|
-
params.id = _this.attributes.id;
|
833
|
-
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
834
|
-
_context5.next = 8;
|
835
|
-
break;
|
836
|
-
}
|
837
|
-
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
838
|
-
case 8:
|
839
|
-
if (params['id']) {
|
840
|
-
_context5.next = 14;
|
841
|
-
break;
|
842
|
-
}
|
843
|
-
if (!_this.attributes.id) {
|
844
|
-
_context5.next = 13;
|
845
|
-
break;
|
846
|
-
}
|
847
|
-
params['id'] = _this.id;
|
848
|
-
_context5.next = 14;
|
849
|
-
break;
|
850
|
-
case 13:
|
851
|
-
throw new errors.MissingParameterError('Parameter missing: id');
|
852
|
-
case 14:
|
853
|
-
_context5.next = 16;
|
854
|
-
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
|
855
|
-
case 16:
|
856
|
-
response = _context5.sent;
|
857
|
-
return _context5.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
858
|
-
case 18:
|
859
|
-
case "end":
|
860
|
-
return _context5.stop();
|
861
|
-
}
|
862
|
-
}
|
863
|
-
}, _callee5);
|
864
|
-
})));
|
865
|
-
(0, _defineProperty2.default)(this, "destroy", function () {
|
866
|
-
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
867
|
-
return _this.delete(params);
|
868
|
-
});
|
869
|
-
(0, _defineProperty2.default)(this, "save", function () {
|
870
|
-
if (_this.attributes['id']) {
|
871
|
-
return _this.update(_this.attributes);
|
872
|
-
} else {
|
873
|
-
var newObject = User.create(_this.attributes, _this.options);
|
874
|
-
_this.attributes = _objectSpread({}, newObject.attributes);
|
875
|
-
return true;
|
876
|
-
}
|
877
|
-
});
|
878
|
-
Object.entries(attributes).forEach(function (_ref6) {
|
879
|
-
var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
|
880
|
-
key = _ref7[0],
|
881
|
-
value = _ref7[1];
|
882
|
-
var normalizedKey = key.replace('?', '');
|
883
|
-
_this.attributes[normalizedKey] = value;
|
884
|
-
Object.defineProperty(_this, normalizedKey, {
|
885
|
-
value: value,
|
886
|
-
writable: false
|
887
|
-
});
|
888
|
-
});
|
889
|
-
this.options = _objectSpread({}, options);
|
890
|
-
});
|
891
|
-
(0, _defineProperty2.default)(User, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
892
|
-
var _response$data;
|
893
|
-
var params,
|
894
|
-
options,
|
895
|
-
response,
|
896
|
-
_args6 = arguments;
|
897
|
-
return _regenerator.default.wrap(function _callee6$(_context6) {
|
898
|
-
while (1) {
|
899
|
-
switch (_context6.prev = _context6.next) {
|
606
|
+
while (1) switch (_context4.prev = _context4.next) {
|
900
607
|
case 0:
|
901
|
-
params =
|
902
|
-
|
903
|
-
|
904
|
-
_context6.next = 4;
|
608
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
609
|
+
if (_this.attributes.id) {
|
610
|
+
_context4.next = 3;
|
905
611
|
break;
|
906
612
|
}
|
907
|
-
throw new errors.
|
908
|
-
case
|
909
|
-
if (
|
910
|
-
|
613
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
614
|
+
case 3:
|
615
|
+
if ((0, _utils.isObject)(params)) {
|
616
|
+
_context4.next = 5;
|
911
617
|
break;
|
912
618
|
}
|
913
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
914
|
-
case
|
915
|
-
|
916
|
-
|
619
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
620
|
+
case 5:
|
621
|
+
params.id = _this.attributes.id;
|
622
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
623
|
+
_context4.next = 8;
|
917
624
|
break;
|
918
625
|
}
|
919
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
626
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
920
627
|
case 8:
|
921
|
-
if (!(params['search'] && !(0, _utils.isString)(params['search']))) {
|
922
|
-
_context6.next = 10;
|
923
|
-
break;
|
924
|
-
}
|
925
|
-
throw new errors.InvalidParameterError("Bad parameter: search must be of type String, received ".concat((0, _utils.getType)(params['search'])));
|
926
|
-
case 10:
|
927
|
-
_context6.next = 12;
|
928
|
-
return _Api.default.sendRequest("/users", 'GET', params, options);
|
929
|
-
case 12:
|
930
|
-
response = _context6.sent;
|
931
|
-
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) {
|
932
|
-
return new User(obj, options);
|
933
|
-
})) || []);
|
934
|
-
case 14:
|
935
|
-
case "end":
|
936
|
-
return _context6.stop();
|
937
|
-
}
|
938
|
-
}
|
939
|
-
}, _callee6);
|
940
|
-
})));
|
941
|
-
(0, _defineProperty2.default)(User, "all", function () {
|
942
|
-
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
943
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
944
|
-
return User.list(params, options);
|
945
|
-
});
|
946
|
-
(0, _defineProperty2.default)(User, "find", /*#__PURE__*/function () {
|
947
|
-
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id) {
|
948
|
-
var params,
|
949
|
-
options,
|
950
|
-
response,
|
951
|
-
_args7 = arguments;
|
952
|
-
return _regenerator.default.wrap(function _callee7$(_context7) {
|
953
|
-
while (1) {
|
954
|
-
switch (_context7.prev = _context7.next) {
|
955
|
-
case 0:
|
956
|
-
params = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
957
|
-
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
958
|
-
if ((0, _utils.isObject)(params)) {
|
959
|
-
_context7.next = 4;
|
960
|
-
break;
|
961
|
-
}
|
962
|
-
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
963
|
-
case 4:
|
964
|
-
params['id'] = id;
|
965
|
-
if (params['id']) {
|
966
|
-
_context7.next = 7;
|
967
|
-
break;
|
968
|
-
}
|
969
|
-
throw new errors.MissingParameterError('Parameter missing: id');
|
970
|
-
case 7:
|
971
|
-
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
972
|
-
_context7.next = 9;
|
973
|
-
break;
|
974
|
-
}
|
975
|
-
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
|
976
|
-
case 9:
|
977
|
-
_context7.next = 11;
|
978
|
-
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
|
979
|
-
case 11:
|
980
|
-
response = _context7.sent;
|
981
|
-
return _context7.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, options));
|
982
|
-
case 13:
|
983
|
-
case "end":
|
984
|
-
return _context7.stop();
|
985
|
-
}
|
986
|
-
}
|
987
|
-
}, _callee7);
|
988
|
-
}));
|
989
|
-
return function (_x) {
|
990
|
-
return _ref9.apply(this, arguments);
|
991
|
-
};
|
992
|
-
}());
|
993
|
-
(0, _defineProperty2.default)(User, "get", function (id) {
|
994
|
-
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
995
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
996
|
-
return User.find(id, params, options);
|
997
|
-
});
|
998
|
-
(0, _defineProperty2.default)(User, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
999
|
-
var params,
|
1000
|
-
options,
|
1001
|
-
response,
|
1002
|
-
_args8 = arguments;
|
1003
|
-
return _regenerator.default.wrap(function _callee8$(_context8) {
|
1004
|
-
while (1) {
|
1005
|
-
switch (_context8.prev = _context8.next) {
|
1006
|
-
case 0:
|
1007
|
-
params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
1008
|
-
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
1009
628
|
if (!(params['change_password'] && !(0, _utils.isString)(params['change_password']))) {
|
1010
|
-
|
629
|
+
_context4.next = 10;
|
1011
630
|
break;
|
1012
631
|
}
|
1013
|
-
throw new errors.InvalidParameterError("Bad parameter: change_password must be of type String, received ".concat((0, _utils.getType)(
|
1014
|
-
case
|
632
|
+
throw new errors.InvalidParameterError("Bad parameter: change_password must be of type String, received ".concat((0, _utils.getType)(change_password)));
|
633
|
+
case 10:
|
1015
634
|
if (!(params['change_password_confirmation'] && !(0, _utils.isString)(params['change_password_confirmation']))) {
|
1016
|
-
|
635
|
+
_context4.next = 12;
|
1017
636
|
break;
|
1018
637
|
}
|
1019
|
-
throw new errors.InvalidParameterError("Bad parameter: change_password_confirmation must be of type String, received ".concat((0, _utils.getType)(
|
1020
|
-
case
|
638
|
+
throw new errors.InvalidParameterError("Bad parameter: change_password_confirmation must be of type String, received ".concat((0, _utils.getType)(change_password_confirmation)));
|
639
|
+
case 12:
|
1021
640
|
if (!(params['email'] && !(0, _utils.isString)(params['email']))) {
|
1022
|
-
|
641
|
+
_context4.next = 14;
|
1023
642
|
break;
|
1024
643
|
}
|
1025
|
-
throw new errors.InvalidParameterError("Bad parameter: email must be of type String, received ".concat((0, _utils.getType)(
|
1026
|
-
case
|
644
|
+
throw new errors.InvalidParameterError("Bad parameter: email must be of type String, received ".concat((0, _utils.getType)(email)));
|
645
|
+
case 14:
|
1027
646
|
if (!(params['grant_permission'] && !(0, _utils.isString)(params['grant_permission']))) {
|
1028
|
-
|
647
|
+
_context4.next = 16;
|
1029
648
|
break;
|
1030
649
|
}
|
1031
|
-
throw new errors.InvalidParameterError("Bad parameter: grant_permission must be of type String, received ".concat((0, _utils.getType)(
|
1032
|
-
case
|
650
|
+
throw new errors.InvalidParameterError("Bad parameter: grant_permission must be of type String, received ".concat((0, _utils.getType)(grant_permission)));
|
651
|
+
case 16:
|
1033
652
|
if (!(params['group_id'] && !(0, _utils.isInt)(params['group_id']))) {
|
1034
|
-
|
653
|
+
_context4.next = 18;
|
1035
654
|
break;
|
1036
655
|
}
|
1037
|
-
throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(
|
1038
|
-
case
|
656
|
+
throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(group_id)));
|
657
|
+
case 18:
|
1039
658
|
if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
|
1040
|
-
|
659
|
+
_context4.next = 20;
|
1041
660
|
break;
|
1042
661
|
}
|
1043
|
-
throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(
|
1044
|
-
case
|
662
|
+
throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(group_ids)));
|
663
|
+
case 20:
|
1045
664
|
if (!(params['imported_password_hash'] && !(0, _utils.isString)(params['imported_password_hash']))) {
|
1046
|
-
|
665
|
+
_context4.next = 22;
|
1047
666
|
break;
|
1048
667
|
}
|
1049
|
-
throw new errors.InvalidParameterError("Bad parameter: imported_password_hash must be of type String, received ".concat((0, _utils.getType)(
|
1050
|
-
case
|
668
|
+
throw new errors.InvalidParameterError("Bad parameter: imported_password_hash must be of type String, received ".concat((0, _utils.getType)(imported_password_hash)));
|
669
|
+
case 22:
|
1051
670
|
if (!(params['password'] && !(0, _utils.isString)(params['password']))) {
|
1052
|
-
|
671
|
+
_context4.next = 24;
|
1053
672
|
break;
|
1054
673
|
}
|
1055
|
-
throw new errors.InvalidParameterError("Bad parameter: password must be of type String, received ".concat((0, _utils.getType)(
|
1056
|
-
case
|
674
|
+
throw new errors.InvalidParameterError("Bad parameter: password must be of type String, received ".concat((0, _utils.getType)(password)));
|
675
|
+
case 24:
|
1057
676
|
if (!(params['password_confirmation'] && !(0, _utils.isString)(params['password_confirmation']))) {
|
1058
|
-
|
677
|
+
_context4.next = 26;
|
1059
678
|
break;
|
1060
679
|
}
|
1061
|
-
throw new errors.InvalidParameterError("Bad parameter: password_confirmation must be of type String, received ".concat((0, _utils.getType)(
|
1062
|
-
case
|
680
|
+
throw new errors.InvalidParameterError("Bad parameter: password_confirmation must be of type String, received ".concat((0, _utils.getType)(password_confirmation)));
|
681
|
+
case 26:
|
1063
682
|
if (!(params['allowed_ips'] && !(0, _utils.isString)(params['allowed_ips']))) {
|
1064
|
-
|
683
|
+
_context4.next = 28;
|
1065
684
|
break;
|
1066
685
|
}
|
1067
|
-
throw new errors.InvalidParameterError("Bad parameter: allowed_ips must be of type String, received ".concat((0, _utils.getType)(
|
1068
|
-
case
|
686
|
+
throw new errors.InvalidParameterError("Bad parameter: allowed_ips must be of type String, received ".concat((0, _utils.getType)(allowed_ips)));
|
687
|
+
case 28:
|
1069
688
|
if (!(params['authenticate_until'] && !(0, _utils.isString)(params['authenticate_until']))) {
|
1070
|
-
|
689
|
+
_context4.next = 30;
|
1071
690
|
break;
|
1072
691
|
}
|
1073
|
-
throw new errors.InvalidParameterError("Bad parameter: authenticate_until must be of type String, received ".concat((0, _utils.getType)(
|
1074
|
-
case
|
692
|
+
throw new errors.InvalidParameterError("Bad parameter: authenticate_until must be of type String, received ".concat((0, _utils.getType)(authenticate_until)));
|
693
|
+
case 30:
|
1075
694
|
if (!(params['authentication_method'] && !(0, _utils.isString)(params['authentication_method']))) {
|
1076
|
-
|
695
|
+
_context4.next = 32;
|
1077
696
|
break;
|
1078
697
|
}
|
1079
|
-
throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(
|
1080
|
-
case
|
698
|
+
throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(authentication_method)));
|
699
|
+
case 32:
|
1081
700
|
if (!(params['header_text'] && !(0, _utils.isString)(params['header_text']))) {
|
1082
|
-
|
701
|
+
_context4.next = 34;
|
1083
702
|
break;
|
1084
703
|
}
|
1085
|
-
throw new errors.InvalidParameterError("Bad parameter: header_text must be of type String, received ".concat((0, _utils.getType)(
|
1086
|
-
case
|
704
|
+
throw new errors.InvalidParameterError("Bad parameter: header_text must be of type String, received ".concat((0, _utils.getType)(header_text)));
|
705
|
+
case 34:
|
1087
706
|
if (!(params['language'] && !(0, _utils.isString)(params['language']))) {
|
1088
|
-
|
707
|
+
_context4.next = 36;
|
1089
708
|
break;
|
1090
709
|
}
|
1091
|
-
throw new errors.InvalidParameterError("Bad parameter: language must be of type String, received ".concat((0, _utils.getType)(
|
1092
|
-
case
|
710
|
+
throw new errors.InvalidParameterError("Bad parameter: language must be of type String, received ".concat((0, _utils.getType)(language)));
|
711
|
+
case 36:
|
1093
712
|
if (!(params['notification_daily_send_time'] && !(0, _utils.isInt)(params['notification_daily_send_time']))) {
|
1094
|
-
|
713
|
+
_context4.next = 38;
|
1095
714
|
break;
|
1096
715
|
}
|
1097
|
-
throw new errors.InvalidParameterError("Bad parameter: notification_daily_send_time must be of type Int, received ".concat((0, _utils.getType)(
|
1098
|
-
case
|
716
|
+
throw new errors.InvalidParameterError("Bad parameter: notification_daily_send_time must be of type Int, received ".concat((0, _utils.getType)(notification_daily_send_time)));
|
717
|
+
case 38:
|
1099
718
|
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
1100
|
-
|
719
|
+
_context4.next = 40;
|
1101
720
|
break;
|
1102
721
|
}
|
1103
|
-
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(
|
1104
|
-
case
|
722
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
723
|
+
case 40:
|
1105
724
|
if (!(params['company'] && !(0, _utils.isString)(params['company']))) {
|
1106
|
-
|
725
|
+
_context4.next = 42;
|
1107
726
|
break;
|
1108
727
|
}
|
1109
|
-
throw new errors.InvalidParameterError("Bad parameter: company must be of type String, received ".concat((0, _utils.getType)(
|
1110
|
-
case
|
728
|
+
throw new errors.InvalidParameterError("Bad parameter: company must be of type String, received ".concat((0, _utils.getType)(company)));
|
729
|
+
case 42:
|
1111
730
|
if (!(params['notes'] && !(0, _utils.isString)(params['notes']))) {
|
1112
|
-
|
731
|
+
_context4.next = 44;
|
1113
732
|
break;
|
1114
733
|
}
|
1115
|
-
throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(
|
1116
|
-
case
|
734
|
+
throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(notes)));
|
735
|
+
case 44:
|
1117
736
|
if (!(params['password_validity_days'] && !(0, _utils.isInt)(params['password_validity_days']))) {
|
1118
|
-
|
737
|
+
_context4.next = 46;
|
1119
738
|
break;
|
1120
739
|
}
|
1121
|
-
throw new errors.InvalidParameterError("Bad parameter: password_validity_days must be of type Int, received ".concat((0, _utils.getType)(
|
1122
|
-
case
|
740
|
+
throw new errors.InvalidParameterError("Bad parameter: password_validity_days must be of type Int, received ".concat((0, _utils.getType)(password_validity_days)));
|
741
|
+
case 46:
|
1123
742
|
if (!(params['ssl_required'] && !(0, _utils.isString)(params['ssl_required']))) {
|
1124
|
-
|
743
|
+
_context4.next = 48;
|
1125
744
|
break;
|
1126
745
|
}
|
1127
|
-
throw new errors.InvalidParameterError("Bad parameter: ssl_required must be of type String, received ".concat((0, _utils.getType)(
|
1128
|
-
case
|
746
|
+
throw new errors.InvalidParameterError("Bad parameter: ssl_required must be of type String, received ".concat((0, _utils.getType)(ssl_required)));
|
747
|
+
case 48:
|
1129
748
|
if (!(params['sso_strategy_id'] && !(0, _utils.isInt)(params['sso_strategy_id']))) {
|
1130
|
-
|
749
|
+
_context4.next = 50;
|
1131
750
|
break;
|
1132
751
|
}
|
1133
|
-
throw new errors.InvalidParameterError("Bad parameter: sso_strategy_id must be of type Int, received ".concat((0, _utils.getType)(
|
1134
|
-
case
|
752
|
+
throw new errors.InvalidParameterError("Bad parameter: sso_strategy_id must be of type Int, received ".concat((0, _utils.getType)(sso_strategy_id)));
|
753
|
+
case 50:
|
1135
754
|
if (!(params['require_2fa'] && !(0, _utils.isString)(params['require_2fa']))) {
|
1136
|
-
|
755
|
+
_context4.next = 52;
|
1137
756
|
break;
|
1138
757
|
}
|
1139
|
-
throw new errors.InvalidParameterError("Bad parameter: require_2fa must be of type String, received ".concat((0, _utils.getType)(
|
1140
|
-
case
|
758
|
+
throw new errors.InvalidParameterError("Bad parameter: require_2fa must be of type String, received ".concat((0, _utils.getType)(require_2fa)));
|
759
|
+
case 52:
|
1141
760
|
if (!(params['time_zone'] && !(0, _utils.isString)(params['time_zone']))) {
|
1142
|
-
|
761
|
+
_context4.next = 54;
|
1143
762
|
break;
|
1144
763
|
}
|
1145
|
-
throw new errors.InvalidParameterError("Bad parameter: time_zone must be of type String, received ".concat((0, _utils.getType)(
|
1146
|
-
case
|
764
|
+
throw new errors.InvalidParameterError("Bad parameter: time_zone must be of type String, received ".concat((0, _utils.getType)(time_zone)));
|
765
|
+
case 54:
|
1147
766
|
if (!(params['user_root'] && !(0, _utils.isString)(params['user_root']))) {
|
1148
|
-
|
767
|
+
_context4.next = 56;
|
1149
768
|
break;
|
1150
769
|
}
|
1151
|
-
throw new errors.InvalidParameterError("Bad parameter: user_root must be of type String, received ".concat((0, _utils.getType)(
|
1152
|
-
case
|
770
|
+
throw new errors.InvalidParameterError("Bad parameter: user_root must be of type String, received ".concat((0, _utils.getType)(user_root)));
|
771
|
+
case 56:
|
1153
772
|
if (!(params['username'] && !(0, _utils.isString)(params['username']))) {
|
1154
|
-
|
773
|
+
_context4.next = 58;
|
1155
774
|
break;
|
1156
775
|
}
|
1157
|
-
throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(
|
1158
|
-
case
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
776
|
+
throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(username)));
|
777
|
+
case 58:
|
778
|
+
if (params['id']) {
|
779
|
+
_context4.next = 64;
|
780
|
+
break;
|
781
|
+
}
|
782
|
+
if (!_this.attributes.id) {
|
783
|
+
_context4.next = 63;
|
784
|
+
break;
|
785
|
+
}
|
786
|
+
params['id'] = _this.id;
|
787
|
+
_context4.next = 64;
|
788
|
+
break;
|
789
|
+
case 63:
|
790
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
791
|
+
case 64:
|
792
|
+
_context4.next = 66;
|
793
|
+
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
|
794
|
+
case 66:
|
795
|
+
response = _context4.sent;
|
796
|
+
return _context4.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
797
|
+
case 68:
|
798
|
+
case "end":
|
799
|
+
return _context4.stop();
|
800
|
+
}
|
801
|
+
}, _callee4);
|
802
|
+
})));
|
803
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
804
|
+
var params,
|
805
|
+
response,
|
806
|
+
_args5 = arguments;
|
807
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
808
|
+
while (1) switch (_context5.prev = _context5.next) {
|
809
|
+
case 0:
|
810
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
811
|
+
if (_this.attributes.id) {
|
812
|
+
_context5.next = 3;
|
813
|
+
break;
|
814
|
+
}
|
815
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
816
|
+
case 3:
|
817
|
+
if ((0, _utils.isObject)(params)) {
|
818
|
+
_context5.next = 5;
|
819
|
+
break;
|
820
|
+
}
|
821
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
822
|
+
case 5:
|
823
|
+
params.id = _this.attributes.id;
|
824
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
825
|
+
_context5.next = 8;
|
826
|
+
break;
|
827
|
+
}
|
828
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
829
|
+
case 8:
|
830
|
+
if (params['id']) {
|
831
|
+
_context5.next = 14;
|
832
|
+
break;
|
833
|
+
}
|
834
|
+
if (!_this.attributes.id) {
|
835
|
+
_context5.next = 13;
|
836
|
+
break;
|
837
|
+
}
|
838
|
+
params['id'] = _this.id;
|
839
|
+
_context5.next = 14;
|
840
|
+
break;
|
841
|
+
case 13:
|
842
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
843
|
+
case 14:
|
844
|
+
_context5.next = 16;
|
845
|
+
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
|
846
|
+
case 16:
|
847
|
+
response = _context5.sent;
|
848
|
+
return _context5.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
849
|
+
case 18:
|
1165
850
|
case "end":
|
1166
|
-
return
|
851
|
+
return _context5.stop();
|
1167
852
|
}
|
853
|
+
}, _callee5);
|
854
|
+
})));
|
855
|
+
(0, _defineProperty2.default)(this, "destroy", function () {
|
856
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
857
|
+
return _this.delete(params);
|
858
|
+
});
|
859
|
+
(0, _defineProperty2.default)(this, "save", function () {
|
860
|
+
if (_this.attributes['id']) {
|
861
|
+
return _this.update(_this.attributes);
|
862
|
+
} else {
|
863
|
+
var newObject = User.create(_this.attributes, _this.options);
|
864
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
865
|
+
return true;
|
866
|
+
}
|
867
|
+
});
|
868
|
+
Object.entries(attributes).forEach(function (_ref6) {
|
869
|
+
var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
|
870
|
+
key = _ref7[0],
|
871
|
+
value = _ref7[1];
|
872
|
+
var normalizedKey = key.replace('?', '');
|
873
|
+
_this.attributes[normalizedKey] = value;
|
874
|
+
Object.defineProperty(_this, normalizedKey, {
|
875
|
+
value: value,
|
876
|
+
writable: false
|
877
|
+
});
|
878
|
+
});
|
879
|
+
this.options = _objectSpread({}, options);
|
880
|
+
});
|
881
|
+
(0, _defineProperty2.default)(User, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
882
|
+
var _response$data;
|
883
|
+
var params,
|
884
|
+
options,
|
885
|
+
response,
|
886
|
+
_args6 = arguments;
|
887
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
888
|
+
while (1) switch (_context6.prev = _context6.next) {
|
889
|
+
case 0:
|
890
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
891
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
892
|
+
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
893
|
+
_context6.next = 4;
|
894
|
+
break;
|
895
|
+
}
|
896
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
|
897
|
+
case 4:
|
898
|
+
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
899
|
+
_context6.next = 6;
|
900
|
+
break;
|
901
|
+
}
|
902
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
|
903
|
+
case 6:
|
904
|
+
if (!(params['ids'] && !(0, _utils.isString)(params['ids']))) {
|
905
|
+
_context6.next = 8;
|
906
|
+
break;
|
907
|
+
}
|
908
|
+
throw new errors.InvalidParameterError("Bad parameter: ids must be of type String, received ".concat((0, _utils.getType)(params['ids'])));
|
909
|
+
case 8:
|
910
|
+
if (!(params['search'] && !(0, _utils.isString)(params['search']))) {
|
911
|
+
_context6.next = 10;
|
912
|
+
break;
|
913
|
+
}
|
914
|
+
throw new errors.InvalidParameterError("Bad parameter: search must be of type String, received ".concat((0, _utils.getType)(params['search'])));
|
915
|
+
case 10:
|
916
|
+
_context6.next = 12;
|
917
|
+
return _Api.default.sendRequest("/users", 'GET', params, options);
|
918
|
+
case 12:
|
919
|
+
response = _context6.sent;
|
920
|
+
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) {
|
921
|
+
return new User(obj, options);
|
922
|
+
})) || []);
|
923
|
+
case 14:
|
924
|
+
case "end":
|
925
|
+
return _context6.stop();
|
926
|
+
}
|
927
|
+
}, _callee6);
|
928
|
+
})));
|
929
|
+
(0, _defineProperty2.default)(User, "all", function () {
|
930
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
931
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
932
|
+
return User.list(params, options);
|
933
|
+
});
|
934
|
+
(0, _defineProperty2.default)(User, "find", /*#__PURE__*/function () {
|
935
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id) {
|
936
|
+
var params,
|
937
|
+
options,
|
938
|
+
response,
|
939
|
+
_args7 = arguments;
|
940
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
941
|
+
while (1) switch (_context7.prev = _context7.next) {
|
942
|
+
case 0:
|
943
|
+
params = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
944
|
+
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
945
|
+
if ((0, _utils.isObject)(params)) {
|
946
|
+
_context7.next = 4;
|
947
|
+
break;
|
948
|
+
}
|
949
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
950
|
+
case 4:
|
951
|
+
params['id'] = id;
|
952
|
+
if (params['id']) {
|
953
|
+
_context7.next = 7;
|
954
|
+
break;
|
955
|
+
}
|
956
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
957
|
+
case 7:
|
958
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
959
|
+
_context7.next = 9;
|
960
|
+
break;
|
961
|
+
}
|
962
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
|
963
|
+
case 9:
|
964
|
+
_context7.next = 11;
|
965
|
+
return _Api.default.sendRequest("/users/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
|
966
|
+
case 11:
|
967
|
+
response = _context7.sent;
|
968
|
+
return _context7.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, options));
|
969
|
+
case 13:
|
970
|
+
case "end":
|
971
|
+
return _context7.stop();
|
972
|
+
}
|
973
|
+
}, _callee7);
|
974
|
+
}));
|
975
|
+
return function (_x) {
|
976
|
+
return _ref9.apply(this, arguments);
|
977
|
+
};
|
978
|
+
}());
|
979
|
+
(0, _defineProperty2.default)(User, "get", function (id) {
|
980
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
981
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
982
|
+
return User.find(id, params, options);
|
983
|
+
});
|
984
|
+
(0, _defineProperty2.default)(User, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
985
|
+
var params,
|
986
|
+
options,
|
987
|
+
response,
|
988
|
+
_args8 = arguments;
|
989
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
990
|
+
while (1) switch (_context8.prev = _context8.next) {
|
991
|
+
case 0:
|
992
|
+
params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
993
|
+
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
994
|
+
if (!(params['change_password'] && !(0, _utils.isString)(params['change_password']))) {
|
995
|
+
_context8.next = 4;
|
996
|
+
break;
|
997
|
+
}
|
998
|
+
throw new errors.InvalidParameterError("Bad parameter: change_password must be of type String, received ".concat((0, _utils.getType)(params['change_password'])));
|
999
|
+
case 4:
|
1000
|
+
if (!(params['change_password_confirmation'] && !(0, _utils.isString)(params['change_password_confirmation']))) {
|
1001
|
+
_context8.next = 6;
|
1002
|
+
break;
|
1003
|
+
}
|
1004
|
+
throw new errors.InvalidParameterError("Bad parameter: change_password_confirmation must be of type String, received ".concat((0, _utils.getType)(params['change_password_confirmation'])));
|
1005
|
+
case 6:
|
1006
|
+
if (!(params['email'] && !(0, _utils.isString)(params['email']))) {
|
1007
|
+
_context8.next = 8;
|
1008
|
+
break;
|
1009
|
+
}
|
1010
|
+
throw new errors.InvalidParameterError("Bad parameter: email must be of type String, received ".concat((0, _utils.getType)(params['email'])));
|
1011
|
+
case 8:
|
1012
|
+
if (!(params['grant_permission'] && !(0, _utils.isString)(params['grant_permission']))) {
|
1013
|
+
_context8.next = 10;
|
1014
|
+
break;
|
1015
|
+
}
|
1016
|
+
throw new errors.InvalidParameterError("Bad parameter: grant_permission must be of type String, received ".concat((0, _utils.getType)(params['grant_permission'])));
|
1017
|
+
case 10:
|
1018
|
+
if (!(params['group_id'] && !(0, _utils.isInt)(params['group_id']))) {
|
1019
|
+
_context8.next = 12;
|
1020
|
+
break;
|
1021
|
+
}
|
1022
|
+
throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(params['group_id'])));
|
1023
|
+
case 12:
|
1024
|
+
if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
|
1025
|
+
_context8.next = 14;
|
1026
|
+
break;
|
1027
|
+
}
|
1028
|
+
throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(params['group_ids'])));
|
1029
|
+
case 14:
|
1030
|
+
if (!(params['imported_password_hash'] && !(0, _utils.isString)(params['imported_password_hash']))) {
|
1031
|
+
_context8.next = 16;
|
1032
|
+
break;
|
1033
|
+
}
|
1034
|
+
throw new errors.InvalidParameterError("Bad parameter: imported_password_hash must be of type String, received ".concat((0, _utils.getType)(params['imported_password_hash'])));
|
1035
|
+
case 16:
|
1036
|
+
if (!(params['password'] && !(0, _utils.isString)(params['password']))) {
|
1037
|
+
_context8.next = 18;
|
1038
|
+
break;
|
1039
|
+
}
|
1040
|
+
throw new errors.InvalidParameterError("Bad parameter: password must be of type String, received ".concat((0, _utils.getType)(params['password'])));
|
1041
|
+
case 18:
|
1042
|
+
if (!(params['password_confirmation'] && !(0, _utils.isString)(params['password_confirmation']))) {
|
1043
|
+
_context8.next = 20;
|
1044
|
+
break;
|
1045
|
+
}
|
1046
|
+
throw new errors.InvalidParameterError("Bad parameter: password_confirmation must be of type String, received ".concat((0, _utils.getType)(params['password_confirmation'])));
|
1047
|
+
case 20:
|
1048
|
+
if (!(params['allowed_ips'] && !(0, _utils.isString)(params['allowed_ips']))) {
|
1049
|
+
_context8.next = 22;
|
1050
|
+
break;
|
1051
|
+
}
|
1052
|
+
throw new errors.InvalidParameterError("Bad parameter: allowed_ips must be of type String, received ".concat((0, _utils.getType)(params['allowed_ips'])));
|
1053
|
+
case 22:
|
1054
|
+
if (!(params['authenticate_until'] && !(0, _utils.isString)(params['authenticate_until']))) {
|
1055
|
+
_context8.next = 24;
|
1056
|
+
break;
|
1057
|
+
}
|
1058
|
+
throw new errors.InvalidParameterError("Bad parameter: authenticate_until must be of type String, received ".concat((0, _utils.getType)(params['authenticate_until'])));
|
1059
|
+
case 24:
|
1060
|
+
if (!(params['authentication_method'] && !(0, _utils.isString)(params['authentication_method']))) {
|
1061
|
+
_context8.next = 26;
|
1062
|
+
break;
|
1063
|
+
}
|
1064
|
+
throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(params['authentication_method'])));
|
1065
|
+
case 26:
|
1066
|
+
if (!(params['header_text'] && !(0, _utils.isString)(params['header_text']))) {
|
1067
|
+
_context8.next = 28;
|
1068
|
+
break;
|
1069
|
+
}
|
1070
|
+
throw new errors.InvalidParameterError("Bad parameter: header_text must be of type String, received ".concat((0, _utils.getType)(params['header_text'])));
|
1071
|
+
case 28:
|
1072
|
+
if (!(params['language'] && !(0, _utils.isString)(params['language']))) {
|
1073
|
+
_context8.next = 30;
|
1074
|
+
break;
|
1075
|
+
}
|
1076
|
+
throw new errors.InvalidParameterError("Bad parameter: language must be of type String, received ".concat((0, _utils.getType)(params['language'])));
|
1077
|
+
case 30:
|
1078
|
+
if (!(params['notification_daily_send_time'] && !(0, _utils.isInt)(params['notification_daily_send_time']))) {
|
1079
|
+
_context8.next = 32;
|
1080
|
+
break;
|
1081
|
+
}
|
1082
|
+
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'])));
|
1083
|
+
case 32:
|
1084
|
+
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
1085
|
+
_context8.next = 34;
|
1086
|
+
break;
|
1087
|
+
}
|
1088
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
|
1089
|
+
case 34:
|
1090
|
+
if (!(params['company'] && !(0, _utils.isString)(params['company']))) {
|
1091
|
+
_context8.next = 36;
|
1092
|
+
break;
|
1093
|
+
}
|
1094
|
+
throw new errors.InvalidParameterError("Bad parameter: company must be of type String, received ".concat((0, _utils.getType)(params['company'])));
|
1095
|
+
case 36:
|
1096
|
+
if (!(params['notes'] && !(0, _utils.isString)(params['notes']))) {
|
1097
|
+
_context8.next = 38;
|
1098
|
+
break;
|
1099
|
+
}
|
1100
|
+
throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(params['notes'])));
|
1101
|
+
case 38:
|
1102
|
+
if (!(params['password_validity_days'] && !(0, _utils.isInt)(params['password_validity_days']))) {
|
1103
|
+
_context8.next = 40;
|
1104
|
+
break;
|
1105
|
+
}
|
1106
|
+
throw new errors.InvalidParameterError("Bad parameter: password_validity_days must be of type Int, received ".concat((0, _utils.getType)(params['password_validity_days'])));
|
1107
|
+
case 40:
|
1108
|
+
if (!(params['ssl_required'] && !(0, _utils.isString)(params['ssl_required']))) {
|
1109
|
+
_context8.next = 42;
|
1110
|
+
break;
|
1111
|
+
}
|
1112
|
+
throw new errors.InvalidParameterError("Bad parameter: ssl_required must be of type String, received ".concat((0, _utils.getType)(params['ssl_required'])));
|
1113
|
+
case 42:
|
1114
|
+
if (!(params['sso_strategy_id'] && !(0, _utils.isInt)(params['sso_strategy_id']))) {
|
1115
|
+
_context8.next = 44;
|
1116
|
+
break;
|
1117
|
+
}
|
1118
|
+
throw new errors.InvalidParameterError("Bad parameter: sso_strategy_id must be of type Int, received ".concat((0, _utils.getType)(params['sso_strategy_id'])));
|
1119
|
+
case 44:
|
1120
|
+
if (!(params['require_2fa'] && !(0, _utils.isString)(params['require_2fa']))) {
|
1121
|
+
_context8.next = 46;
|
1122
|
+
break;
|
1123
|
+
}
|
1124
|
+
throw new errors.InvalidParameterError("Bad parameter: require_2fa must be of type String, received ".concat((0, _utils.getType)(params['require_2fa'])));
|
1125
|
+
case 46:
|
1126
|
+
if (!(params['time_zone'] && !(0, _utils.isString)(params['time_zone']))) {
|
1127
|
+
_context8.next = 48;
|
1128
|
+
break;
|
1129
|
+
}
|
1130
|
+
throw new errors.InvalidParameterError("Bad parameter: time_zone must be of type String, received ".concat((0, _utils.getType)(params['time_zone'])));
|
1131
|
+
case 48:
|
1132
|
+
if (!(params['user_root'] && !(0, _utils.isString)(params['user_root']))) {
|
1133
|
+
_context8.next = 50;
|
1134
|
+
break;
|
1135
|
+
}
|
1136
|
+
throw new errors.InvalidParameterError("Bad parameter: user_root must be of type String, received ".concat((0, _utils.getType)(params['user_root'])));
|
1137
|
+
case 50:
|
1138
|
+
if (!(params['username'] && !(0, _utils.isString)(params['username']))) {
|
1139
|
+
_context8.next = 52;
|
1140
|
+
break;
|
1141
|
+
}
|
1142
|
+
throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(params['username'])));
|
1143
|
+
case 52:
|
1144
|
+
_context8.next = 54;
|
1145
|
+
return _Api.default.sendRequest("/users", 'POST', params, options);
|
1146
|
+
case 54:
|
1147
|
+
response = _context8.sent;
|
1148
|
+
return _context8.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, options));
|
1149
|
+
case 56:
|
1150
|
+
case "end":
|
1151
|
+
return _context8.stop();
|
1168
1152
|
}
|
1169
1153
|
}, _callee8);
|
1170
1154
|
})));
|