files.com 1.2.245 → 1.2.246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.245
1
+ 1.2.246
@@ -73,6 +73,44 @@ await UserLifecycleRule.create({
73
73
 
74
74
  ---
75
75
 
76
+ ## Update User Lifecycle Rule
77
+
78
+ ```
79
+ const user_lifecycle_rule = await UserLifecycleRule.find(id)
80
+
81
+ await user_lifecycle_rule.update({
82
+ 'authentication_method': "password",
83
+ 'inactivity_days': 12,
84
+ 'include_site_admins': true,
85
+ 'include_folder_admins': true,
86
+ })
87
+ ```
88
+
89
+ ### Parameters
90
+
91
+ * `id` (int64): Required - User Lifecycle Rule ID.
92
+ * `action` (string): Required - Action to take on inactive users (disable or delete)
93
+ * `authentication_method` (string): Required - User authentication method for the rule
94
+ * `inactivity_days` (int64): Required - Number of days of inactivity before the rule applies
95
+ * `include_site_admins` (boolean): Include site admins in the rule
96
+ * `include_folder_admins` (boolean): Include folder admins in the rule
97
+
98
+ ### Example Response
99
+
100
+ ```json
101
+ {
102
+ "id": 1,
103
+ "authentication_method": "password",
104
+ "inactivity_days": 12,
105
+ "include_folder_admins": true,
106
+ "include_site_admins": true,
107
+ "action": "disable",
108
+ "site_id": 1
109
+ }
110
+ ```
111
+
112
+ ---
113
+
76
114
  ## Delete User Lifecycle Rule
77
115
 
78
116
  ```
package/lib/Files.js CHANGED
@@ -12,7 +12,7 @@ var apiKey;
12
12
  var baseUrl = 'https://app.files.com';
13
13
  var sessionId = null;
14
14
  var language = null;
15
- var version = '1.2.245';
15
+ var version = '1.2.246';
16
16
  var userAgent = "Files.com JavaScript SDK v".concat(version);
17
17
  var logLevel = _Logger.LogLevel.INFO;
18
18
  var debugRequest = false;
@@ -81,8 +81,15 @@ var UserLifecycleRule = /*#__PURE__*/(0, _createClass2.default)(function UserLif
81
81
  (0, _defineProperty2.default)(this, "setSiteId", function (value) {
82
82
  _this.attributes.site_id = value;
83
83
  });
84
- (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
84
+ // Parameters:
85
+ // action (required) - string - Action to take on inactive users (disable or delete)
86
+ // authentication_method (required) - string - User authentication method for the rule
87
+ // inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
88
+ // include_site_admins - boolean - Include site admins in the rule
89
+ // include_folder_admins - boolean - Include folder admins in the rule
90
+ (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
85
91
  var params,
92
+ response,
86
93
  _args = arguments;
87
94
  return _regenerator.default.wrap(function _callee$(_context) {
88
95
  while (1) switch (_context.prev = _context.next) {
@@ -107,59 +114,175 @@ var UserLifecycleRule = /*#__PURE__*/(0, _createClass2.default)(function UserLif
107
114
  }
108
115
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
109
116
  case 8:
110
- if (params.id) {
117
+ if (!(params.action && !(0, _utils.isString)(params.action))) {
118
+ _context.next = 10;
119
+ break;
120
+ }
121
+ throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
122
+ case 10:
123
+ if (!(params.authentication_method && !(0, _utils.isString)(params.authentication_method))) {
124
+ _context.next = 12;
125
+ break;
126
+ }
127
+ throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(params.authentication_method)));
128
+ case 12:
129
+ if (!(params.inactivity_days && !(0, _utils.isInt)(params.inactivity_days))) {
111
130
  _context.next = 14;
112
131
  break;
113
132
  }
133
+ throw new errors.InvalidParameterError("Bad parameter: inactivity_days must be of type Int, received ".concat((0, _utils.getType)(params.inactivity_days)));
134
+ case 14:
135
+ if (params.id) {
136
+ _context.next = 20;
137
+ break;
138
+ }
139
+ if (!_this.attributes.id) {
140
+ _context.next = 19;
141
+ break;
142
+ }
143
+ params.id = _this.id;
144
+ _context.next = 20;
145
+ break;
146
+ case 19:
147
+ throw new errors.MissingParameterError('Parameter missing: id');
148
+ case 20:
149
+ if (params.action) {
150
+ _context.next = 26;
151
+ break;
152
+ }
153
+ if (!_this.attributes.action) {
154
+ _context.next = 25;
155
+ break;
156
+ }
157
+ params.action = _this.action;
158
+ _context.next = 26;
159
+ break;
160
+ case 25:
161
+ throw new errors.MissingParameterError('Parameter missing: action');
162
+ case 26:
163
+ if (params.authentication_method) {
164
+ _context.next = 32;
165
+ break;
166
+ }
167
+ if (!_this.attributes.authentication_method) {
168
+ _context.next = 31;
169
+ break;
170
+ }
171
+ params.authentication_method = _this.authentication_method;
172
+ _context.next = 32;
173
+ break;
174
+ case 31:
175
+ throw new errors.MissingParameterError('Parameter missing: authentication_method');
176
+ case 32:
177
+ if (params.inactivity_days) {
178
+ _context.next = 38;
179
+ break;
180
+ }
181
+ if (!_this.attributes.inactivity_days) {
182
+ _context.next = 37;
183
+ break;
184
+ }
185
+ params.inactivity_days = _this.inactivity_days;
186
+ _context.next = 38;
187
+ break;
188
+ case 37:
189
+ throw new errors.MissingParameterError('Parameter missing: inactivity_days');
190
+ case 38:
191
+ _context.next = 40;
192
+ return _Api.default.sendRequest("/user_lifecycle_rules/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
193
+ case 40:
194
+ response = _context.sent;
195
+ return _context.abrupt("return", new UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, _this.options));
196
+ case 42:
197
+ case "end":
198
+ return _context.stop();
199
+ }
200
+ }, _callee);
201
+ })));
202
+ (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
203
+ var params,
204
+ _args2 = arguments;
205
+ return _regenerator.default.wrap(function _callee2$(_context2) {
206
+ while (1) switch (_context2.prev = _context2.next) {
207
+ case 0:
208
+ params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
209
+ if (_this.attributes.id) {
210
+ _context2.next = 3;
211
+ break;
212
+ }
213
+ throw new errors.EmptyPropertyError('Current object has no id');
214
+ case 3:
215
+ if ((0, _utils.isObject)(params)) {
216
+ _context2.next = 5;
217
+ break;
218
+ }
219
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
220
+ case 5:
221
+ params.id = _this.attributes.id;
222
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
223
+ _context2.next = 8;
224
+ break;
225
+ }
226
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
227
+ case 8:
228
+ if (params.id) {
229
+ _context2.next = 14;
230
+ break;
231
+ }
114
232
  if (!_this.attributes.id) {
115
- _context.next = 13;
233
+ _context2.next = 13;
116
234
  break;
117
235
  }
118
236
  params.id = _this.id;
119
- _context.next = 14;
237
+ _context2.next = 14;
120
238
  break;
121
239
  case 13:
122
240
  throw new errors.MissingParameterError('Parameter missing: id');
123
241
  case 14:
124
- _context.next = 16;
242
+ _context2.next = 16;
125
243
  return _Api.default.sendRequest("/user_lifecycle_rules/".concat(encodeURIComponent(params.id)), 'DELETE', params, _this.options);
126
244
  case 16:
127
245
  case "end":
128
- return _context.stop();
246
+ return _context2.stop();
129
247
  }
130
- }, _callee);
248
+ }, _callee2);
131
249
  })));
132
250
  (0, _defineProperty2.default)(this, "destroy", function () {
133
251
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
134
252
  return _this.delete(params);
135
253
  });
136
- (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
137
- var newObject;
138
- return _regenerator.default.wrap(function _callee2$(_context2) {
139
- while (1) switch (_context2.prev = _context2.next) {
254
+ (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
255
+ var _newObject, newObject;
256
+ return _regenerator.default.wrap(function _callee3$(_context3) {
257
+ while (1) switch (_context3.prev = _context3.next) {
140
258
  case 0:
141
259
  if (!_this.attributes.id) {
142
- _context2.next = 4;
260
+ _context3.next = 6;
143
261
  break;
144
262
  }
145
- throw new errors.NotImplementedError('The UserLifecycleRule object doesn\'t support updates.');
146
- case 4:
147
- _context2.next = 6;
148
- return UserLifecycleRule.create(_this.attributes, _this.options);
263
+ _context3.next = 3;
264
+ return _this.update(_this.attributes);
265
+ case 3:
266
+ _newObject = _context3.sent;
267
+ _this.attributes = _objectSpread({}, _newObject.attributes);
268
+ return _context3.abrupt("return", true);
149
269
  case 6:
150
- newObject = _context2.sent;
270
+ _context3.next = 8;
271
+ return UserLifecycleRule.create(_this.attributes, _this.options);
272
+ case 8:
273
+ newObject = _context3.sent;
151
274
  _this.attributes = _objectSpread({}, newObject.attributes);
152
- return _context2.abrupt("return", true);
153
- case 9:
275
+ return _context3.abrupt("return", true);
276
+ case 11:
154
277
  case "end":
155
- return _context2.stop();
278
+ return _context3.stop();
156
279
  }
157
- }, _callee2);
280
+ }, _callee3);
158
281
  })));
159
- Object.entries(attributes).forEach(function (_ref3) {
160
- var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
161
- key = _ref4[0],
162
- value = _ref4[1];
282
+ Object.entries(attributes).forEach(function (_ref4) {
283
+ var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
284
+ key = _ref5[0],
285
+ value = _ref5[1];
163
286
  var normalizedKey = key.replace('?', '');
164
287
  _this.attributes[normalizedKey] = value;
165
288
  Object.defineProperty(_this, normalizedKey, {
@@ -173,41 +296,41 @@ _UserLifecycleRule = UserLifecycleRule;
173
296
  // Parameters:
174
297
  // cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
175
298
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
176
- (0, _defineProperty2.default)(UserLifecycleRule, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
299
+ (0, _defineProperty2.default)(UserLifecycleRule, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
177
300
  var _response$data;
178
301
  var params,
179
302
  options,
180
303
  response,
181
- _args3 = arguments;
182
- return _regenerator.default.wrap(function _callee3$(_context3) {
183
- while (1) switch (_context3.prev = _context3.next) {
304
+ _args4 = arguments;
305
+ return _regenerator.default.wrap(function _callee4$(_context4) {
306
+ while (1) switch (_context4.prev = _context4.next) {
184
307
  case 0:
185
- params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
186
- options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
308
+ params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
309
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
187
310
  if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
188
- _context3.next = 4;
311
+ _context4.next = 4;
189
312
  break;
190
313
  }
191
314
  throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
192
315
  case 4:
193
316
  if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
194
- _context3.next = 6;
317
+ _context4.next = 6;
195
318
  break;
196
319
  }
197
320
  throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
198
321
  case 6:
199
- _context3.next = 8;
322
+ _context4.next = 8;
200
323
  return _Api.default.sendRequest('/user_lifecycle_rules', 'GET', params, options);
201
324
  case 8:
202
- response = _context3.sent;
203
- return _context3.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
325
+ response = _context4.sent;
326
+ 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) {
204
327
  return new _UserLifecycleRule(obj, options);
205
328
  })) || []);
206
329
  case 10:
207
330
  case "end":
208
- return _context3.stop();
331
+ return _context4.stop();
209
332
  }
210
- }, _callee3);
333
+ }, _callee4);
211
334
  })));
212
335
  (0, _defineProperty2.default)(UserLifecycleRule, "all", function () {
213
336
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -217,48 +340,48 @@ _UserLifecycleRule = UserLifecycleRule;
217
340
  // Parameters:
218
341
  // id (required) - int64 - User Lifecycle Rule ID.
219
342
  (0, _defineProperty2.default)(UserLifecycleRule, "find", /*#__PURE__*/function () {
220
- var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(id) {
343
+ var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
221
344
  var params,
222
345
  options,
223
346
  response,
224
- _args4 = arguments;
225
- return _regenerator.default.wrap(function _callee4$(_context4) {
226
- while (1) switch (_context4.prev = _context4.next) {
347
+ _args5 = arguments;
348
+ return _regenerator.default.wrap(function _callee5$(_context5) {
349
+ while (1) switch (_context5.prev = _context5.next) {
227
350
  case 0:
228
- params = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
229
- options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
351
+ params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
352
+ options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
230
353
  if ((0, _utils.isObject)(params)) {
231
- _context4.next = 4;
354
+ _context5.next = 4;
232
355
  break;
233
356
  }
234
357
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
235
358
  case 4:
236
359
  params.id = id;
237
360
  if (params.id) {
238
- _context4.next = 7;
361
+ _context5.next = 7;
239
362
  break;
240
363
  }
241
364
  throw new errors.MissingParameterError('Parameter missing: id');
242
365
  case 7:
243
366
  if (!(params.id && !(0, _utils.isInt)(params.id))) {
244
- _context4.next = 9;
367
+ _context5.next = 9;
245
368
  break;
246
369
  }
247
370
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
248
371
  case 9:
249
- _context4.next = 11;
372
+ _context5.next = 11;
250
373
  return _Api.default.sendRequest("/user_lifecycle_rules/".concat(encodeURIComponent(params.id)), 'GET', params, options);
251
374
  case 11:
252
- response = _context4.sent;
253
- return _context4.abrupt("return", new _UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, options));
375
+ response = _context5.sent;
376
+ return _context5.abrupt("return", new _UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, options));
254
377
  case 13:
255
378
  case "end":
256
- return _context4.stop();
379
+ return _context5.stop();
257
380
  }
258
- }, _callee4);
381
+ }, _callee5);
259
382
  }));
260
383
  return function (_x) {
261
- return _ref6.apply(this, arguments);
384
+ return _ref7.apply(this, arguments);
262
385
  };
263
386
  }());
264
387
  (0, _defineProperty2.default)(UserLifecycleRule, "get", function (id) {
@@ -272,62 +395,62 @@ _UserLifecycleRule = UserLifecycleRule;
272
395
  // inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
273
396
  // include_site_admins - boolean - Include site admins in the rule
274
397
  // include_folder_admins - boolean - Include folder admins in the rule
275
- (0, _defineProperty2.default)(UserLifecycleRule, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
398
+ (0, _defineProperty2.default)(UserLifecycleRule, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
276
399
  var params,
277
400
  options,
278
401
  response,
279
- _args5 = arguments;
280
- return _regenerator.default.wrap(function _callee5$(_context5) {
281
- while (1) switch (_context5.prev = _context5.next) {
402
+ _args6 = arguments;
403
+ return _regenerator.default.wrap(function _callee6$(_context6) {
404
+ while (1) switch (_context6.prev = _context6.next) {
282
405
  case 0:
283
- params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
284
- options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
406
+ params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
407
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
285
408
  if (params.action) {
286
- _context5.next = 4;
409
+ _context6.next = 4;
287
410
  break;
288
411
  }
289
412
  throw new errors.MissingParameterError('Parameter missing: action');
290
413
  case 4:
291
414
  if (params.authentication_method) {
292
- _context5.next = 6;
415
+ _context6.next = 6;
293
416
  break;
294
417
  }
295
418
  throw new errors.MissingParameterError('Parameter missing: authentication_method');
296
419
  case 6:
297
420
  if (params.inactivity_days) {
298
- _context5.next = 8;
421
+ _context6.next = 8;
299
422
  break;
300
423
  }
301
424
  throw new errors.MissingParameterError('Parameter missing: inactivity_days');
302
425
  case 8:
303
426
  if (!(params.action && !(0, _utils.isString)(params.action))) {
304
- _context5.next = 10;
427
+ _context6.next = 10;
305
428
  break;
306
429
  }
307
430
  throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
308
431
  case 10:
309
432
  if (!(params.authentication_method && !(0, _utils.isString)(params.authentication_method))) {
310
- _context5.next = 12;
433
+ _context6.next = 12;
311
434
  break;
312
435
  }
313
436
  throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(params.authentication_method)));
314
437
  case 12:
315
438
  if (!(params.inactivity_days && !(0, _utils.isInt)(params.inactivity_days))) {
316
- _context5.next = 14;
439
+ _context6.next = 14;
317
440
  break;
318
441
  }
319
442
  throw new errors.InvalidParameterError("Bad parameter: inactivity_days must be of type Int, received ".concat((0, _utils.getType)(params.inactivity_days)));
320
443
  case 14:
321
- _context5.next = 16;
444
+ _context6.next = 16;
322
445
  return _Api.default.sendRequest('/user_lifecycle_rules', 'POST', params, options);
323
446
  case 16:
324
- response = _context5.sent;
325
- return _context5.abrupt("return", new _UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, options));
447
+ response = _context6.sent;
448
+ return _context6.abrupt("return", new _UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, options));
326
449
  case 18:
327
450
  case "end":
328
- return _context5.stop();
451
+ return _context6.stop();
329
452
  }
330
- }, _callee5);
453
+ }, _callee6);
331
454
  })));
332
455
  var _default = exports.default = UserLifecycleRule;
333
456
  module.exports = UserLifecycleRule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.245",
3
+ "version": "1.2.246",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Files.js CHANGED
@@ -6,7 +6,7 @@ let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
8
  let language = null
9
- const version = '1.2.245'
9
+ const version = '1.2.246'
10
10
  let userAgent = `Files.com JavaScript SDK v${version}`
11
11
 
12
12
  let logLevel = LogLevel.INFO
@@ -77,6 +77,75 @@ class UserLifecycleRule {
77
77
  this.attributes.site_id = value
78
78
  }
79
79
 
80
+ // Parameters:
81
+ // action (required) - string - Action to take on inactive users (disable or delete)
82
+ // authentication_method (required) - string - User authentication method for the rule
83
+ // inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
84
+ // include_site_admins - boolean - Include site admins in the rule
85
+ // include_folder_admins - boolean - Include folder admins in the rule
86
+ update = async (params = {}) => {
87
+ if (!this.attributes.id) {
88
+ throw new errors.EmptyPropertyError('Current object has no id')
89
+ }
90
+
91
+ if (!isObject(params)) {
92
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
93
+ }
94
+
95
+ params.id = this.attributes.id
96
+ if (params.id && !isInt(params.id)) {
97
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
98
+ }
99
+
100
+ if (params.action && !isString(params.action)) {
101
+ throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(params.action)}`)
102
+ }
103
+
104
+ if (params.authentication_method && !isString(params.authentication_method)) {
105
+ throw new errors.InvalidParameterError(`Bad parameter: authentication_method must be of type String, received ${getType(params.authentication_method)}`)
106
+ }
107
+
108
+ if (params.inactivity_days && !isInt(params.inactivity_days)) {
109
+ throw new errors.InvalidParameterError(`Bad parameter: inactivity_days must be of type Int, received ${getType(params.inactivity_days)}`)
110
+ }
111
+
112
+ if (!params.id) {
113
+ if (this.attributes.id) {
114
+ params.id = this.id
115
+ } else {
116
+ throw new errors.MissingParameterError('Parameter missing: id')
117
+ }
118
+ }
119
+
120
+ if (!params.action) {
121
+ if (this.attributes.action) {
122
+ params.action = this.action
123
+ } else {
124
+ throw new errors.MissingParameterError('Parameter missing: action')
125
+ }
126
+ }
127
+
128
+ if (!params.authentication_method) {
129
+ if (this.attributes.authentication_method) {
130
+ params.authentication_method = this.authentication_method
131
+ } else {
132
+ throw new errors.MissingParameterError('Parameter missing: authentication_method')
133
+ }
134
+ }
135
+
136
+ if (!params.inactivity_days) {
137
+ if (this.attributes.inactivity_days) {
138
+ params.inactivity_days = this.inactivity_days
139
+ } else {
140
+ throw new errors.MissingParameterError('Parameter missing: inactivity_days')
141
+ }
142
+ }
143
+
144
+ const response = await Api.sendRequest(`/user_lifecycle_rules/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
145
+
146
+ return new UserLifecycleRule(response?.data, this.options)
147
+ }
148
+
80
149
  delete = async (params = {}) => {
81
150
  if (!this.attributes.id) {
82
151
  throw new errors.EmptyPropertyError('Current object has no id')
@@ -107,12 +176,14 @@ class UserLifecycleRule {
107
176
 
108
177
  save = async () => {
109
178
  if (this.attributes.id) {
110
- throw new errors.NotImplementedError('The UserLifecycleRule object doesn\'t support updates.')
111
- } else {
112
- const newObject = await UserLifecycleRule.create(this.attributes, this.options)
179
+ const newObject = await this.update(this.attributes)
113
180
  this.attributes = { ...newObject.attributes }
114
181
  return true
115
182
  }
183
+
184
+ const newObject = await UserLifecycleRule.create(this.attributes, this.options)
185
+ this.attributes = { ...newObject.attributes }
186
+ return true
116
187
  }
117
188
 
118
189
  // Parameters: