@@ -76,10 +76,10 @@ var Group = /*#__PURE__*/(0, _createClass2.default)(function Group() {
76
76
_this . attributes . usernames = value ;
77
77
} ) ;
78
78
// Parameters:
79
- // name - string - Group name.
80
79
// notes - string - Group notes.
81
80
// user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
82
81
// admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
82
+ // name - string - Group name.
83
83
( 0 , _defineProperty2 . default ) ( this , "update" , /*#__PURE__*/ ( 0 , _asyncToGenerator2 . default ) ( /*#__PURE__*/ _regenerator . default . mark ( function _callee ( ) {
84
84
var params ,
85
85
response ,
@@ -107,29 +107,29 @@ var Group = /*#__PURE__*/(0, _createClass2.default)(function Group() {
107
107
}
108
108
throw new errors . InvalidParameterError ( "Bad parameter: id must be of type Int, received " . concat ( ( 0 , _utils . getType ) ( params [ 'id' ] ) ) ) ;
109
109
case 8 :
110
- if ( ! ( params [ 'name ' ] && ! ( 0 , _utils . isString ) ( params [ 'name ' ] ) ) ) {
110
+ if ( ! ( params [ 'notes ' ] && ! ( 0 , _utils . isString ) ( params [ 'notes ' ] ) ) ) {
111
111
_context . next = 10 ;
112
112
break ;
113
113
}
114
- throw new errors . InvalidParameterError ( "Bad parameter: name must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'name ' ] ) ) ) ;
114
+ throw new errors . InvalidParameterError ( "Bad parameter: notes must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'notes ' ] ) ) ) ;
115
115
case 10 :
116
- if ( ! ( params [ 'notes ' ] && ! ( 0 , _utils . isString ) ( params [ 'notes ' ] ) ) ) {
116
+ if ( ! ( params [ 'user_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'user_ids ' ] ) ) ) {
117
117
_context . next = 12 ;
118
118
break ;
119
119
}
120
- throw new errors . InvalidParameterError ( "Bad parameter: notes must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'notes ' ] ) ) ) ;
120
+ throw new errors . InvalidParameterError ( "Bad parameter: user_ids must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'user_ids ' ] ) ) ) ;
121
121
case 12 :
122
- if ( ! ( params [ 'user_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'user_ids ' ] ) ) ) {
122
+ if ( ! ( params [ 'admin_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'admin_ids ' ] ) ) ) {
123
123
_context . next = 14 ;
124
124
break ;
125
125
}
126
- throw new errors . InvalidParameterError ( "Bad parameter: user_ids must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'user_ids ' ] ) ) ) ;
126
+ throw new errors . InvalidParameterError ( "Bad parameter: admin_ids must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'admin_ids ' ] ) ) ) ;
127
127
case 14 :
128
- if ( ! ( params [ 'admin_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'admin_ids ' ] ) ) ) {
128
+ if ( ! ( params [ 'name ' ] && ! ( 0 , _utils . isString ) ( params [ 'name ' ] ) ) ) {
129
129
_context . next = 16 ;
130
130
break ;
131
131
}
132
- throw new errors . InvalidParameterError ( "Bad parameter: admin_ids must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'admin_ids ' ] ) ) ) ;
132
+ throw new errors . InvalidParameterError ( "Bad parameter: name must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'name ' ] ) ) ) ;
133
133
case 16 :
134
134
if ( params [ 'id' ] ) {
135
135
_context . next = 22 ;
@@ -342,10 +342,10 @@ _class = Group;
342
342
return _class . find ( id , params , options ) ;
343
343
} ) ;
344
344
// Parameters:
345
- // name - string - Group name.
346
345
// notes - string - Group notes.
347
346
// user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
348
347
// admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
348
+ // name (required) - string - Group name.
349
349
( 0 , _defineProperty2 . default ) ( Group , "create" , /*#__PURE__*/ ( 0 , _asyncToGenerator2 . default ) ( /*#__PURE__*/ _regenerator . default . mark ( function _callee5 ( ) {
350
350
var params ,
351
351
options ,
@@ -356,11 +356,11 @@ _class = Group;
356
356
case 0 :
357
357
params = _args5 . length > 0 && _args5 [ 0 ] !== undefined ? _args5 [ 0 ] : { } ;
358
358
options = _args5 . length > 1 && _args5 [ 1 ] !== undefined ? _args5 [ 1 ] : { } ;
359
- if ( ! ( params [ 'name' ] && ! ( 0 , _utils . isString ) ( params [ 'name' ] ) ) ) {
359
+ if ( params [ 'name' ] ) {
360
360
_context5 . next = 4 ;
361
361
break ;
362
362
}
363
- throw new errors . InvalidParameterError ( "Bad parameter : name must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'name' ] ) ) ) ;
363
+ throw new errors . MissingParameterError ( 'Parameter missing : name' ) ;
364
364
case 4 :
365
365
if ( ! ( params [ 'notes' ] && ! ( 0 , _utils . isString ) ( params [ 'notes' ] ) ) ) {
366
366
_context5 . next = 6 ;
@@ -380,12 +380,18 @@ _class = Group;
380
380
}
381
381
throw new errors . InvalidParameterError ( "Bad parameter: admin_ids must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'admin_ids' ] ) ) ) ;
382
382
case 10 :
383
- _context5 . next = 12 ;
384
- return _Api . default . sendRequest ( "/groups" , 'POST' , params , options ) ;
383
+ if ( ! ( params [ 'name' ] && ! ( 0 , _utils . isString ) ( params [ 'name' ] ) ) ) {
384
+ _context5 . next = 12 ;
385
+ break ;
386
+ }
387
+ throw new errors . InvalidParameterError ( "Bad parameter: name must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'name' ] ) ) ) ;
385
388
case 12 :
389
+ _context5 . next = 14 ;
390
+ return _Api . default . sendRequest ( "/groups" , 'POST' , params , options ) ;
391
+ case 14 :
386
392
response = _context5 . sent ;
387
393
return _context5 . abrupt ( "return" , new _class ( response === null || response === void 0 ? void 0 : response . data , options ) ) ;
388
- case 14 :
394
+ case 16 :
389
395
case "end" :
390
396
return _context5 . stop ( ) ;
391
397
}
0 commit comments