@@ -76,10 +76,10 @@ var Group = /*#__PURE__*/(0, _createClass2.default)(function Group() {
7676 _this . attributes . usernames = value ;
7777 } ) ;
7878 // Parameters:
79- // name - string - Group name.
8079 // notes - string - Group notes.
8180 // user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
8281 // admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
82+ // name - string - Group name.
8383 ( 0 , _defineProperty2 . default ) ( this , "update" , /*#__PURE__*/ ( 0 , _asyncToGenerator2 . default ) ( /*#__PURE__*/ _regenerator . default . mark ( function _callee ( ) {
8484 var params ,
8585 response ,
@@ -107,29 +107,29 @@ var Group = /*#__PURE__*/(0, _createClass2.default)(function Group() {
107107 }
108108 throw new errors . InvalidParameterError ( "Bad parameter: id must be of type Int, received " . concat ( ( 0 , _utils . getType ) ( params [ 'id' ] ) ) ) ;
109109 case 8 :
110- if ( ! ( params [ 'name ' ] && ! ( 0 , _utils . isString ) ( params [ 'name ' ] ) ) ) {
110+ if ( ! ( params [ 'notes ' ] && ! ( 0 , _utils . isString ) ( params [ 'notes ' ] ) ) ) {
111111 _context . next = 10 ;
112112 break ;
113113 }
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 ' ] ) ) ) ;
115115 case 10 :
116- if ( ! ( params [ 'notes ' ] && ! ( 0 , _utils . isString ) ( params [ 'notes ' ] ) ) ) {
116+ if ( ! ( params [ 'user_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'user_ids ' ] ) ) ) {
117117 _context . next = 12 ;
118118 break ;
119119 }
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 ' ] ) ) ) ;
121121 case 12 :
122- if ( ! ( params [ 'user_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'user_ids ' ] ) ) ) {
122+ if ( ! ( params [ 'admin_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'admin_ids ' ] ) ) ) {
123123 _context . next = 14 ;
124124 break ;
125125 }
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 ' ] ) ) ) ;
127127 case 14 :
128- if ( ! ( params [ 'admin_ids ' ] && ! ( 0 , _utils . isString ) ( params [ 'admin_ids ' ] ) ) ) {
128+ if ( ! ( params [ 'name ' ] && ! ( 0 , _utils . isString ) ( params [ 'name ' ] ) ) ) {
129129 _context . next = 16 ;
130130 break ;
131131 }
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 ' ] ) ) ) ;
133133 case 16 :
134134 if ( params [ 'id' ] ) {
135135 _context . next = 22 ;
@@ -342,10 +342,10 @@ _class = Group;
342342 return _class . find ( id , params , options ) ;
343343} ) ;
344344// Parameters:
345- // name - string - Group name.
346345// notes - string - Group notes.
347346// user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
348347// 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.
349349( 0 , _defineProperty2 . default ) ( Group , "create" , /*#__PURE__*/ ( 0 , _asyncToGenerator2 . default ) ( /*#__PURE__*/ _regenerator . default . mark ( function _callee5 ( ) {
350350 var params ,
351351 options ,
@@ -356,11 +356,11 @@ _class = Group;
356356 case 0 :
357357 params = _args5 . length > 0 && _args5 [ 0 ] !== undefined ? _args5 [ 0 ] : { } ;
358358 options = _args5 . length > 1 && _args5 [ 1 ] !== undefined ? _args5 [ 1 ] : { } ;
359- if ( ! ( params [ 'name' ] && ! ( 0 , _utils . isString ) ( params [ 'name' ] ) ) ) {
359+ if ( params [ 'name' ] ) {
360360 _context5 . next = 4 ;
361361 break ;
362362 }
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' ) ;
364364 case 4 :
365365 if ( ! ( params [ 'notes' ] && ! ( 0 , _utils . isString ) ( params [ 'notes' ] ) ) ) {
366366 _context5 . next = 6 ;
@@ -380,12 +380,18 @@ _class = Group;
380380 }
381381 throw new errors . InvalidParameterError ( "Bad parameter: admin_ids must be of type String, received " . concat ( ( 0 , _utils . getType ) ( params [ 'admin_ids' ] ) ) ) ;
382382 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' ] ) ) ) ;
385388 case 12 :
389+ _context5 . next = 14 ;
390+ return _Api . default . sendRequest ( "/groups" , 'POST' , params , options ) ;
391+ case 14 :
386392 response = _context5 . sent ;
387393 return _context5 . abrupt ( "return" , new _class ( response === null || response === void 0 ? void 0 : response . data , options ) ) ;
388- case 14 :
394+ case 16 :
389395 case "end" :
390396 return _context5 . stop ( ) ;
391397 }
0 commit comments