files.com 1.0.221 → 1.0.223

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.
Files changed (86) hide show
  1. package/_VERSION +1 -1
  2. package/docs/models/Bundle.md +14 -0
  3. package/lib/Api.js +15 -82
  4. package/lib/Errors.js +9 -962
  5. package/lib/Files.js +0 -11
  6. package/lib/Logger.js +0 -24
  7. package/lib/index.js +0 -5
  8. package/lib/isomorphic/File.node.js +0 -19
  9. package/lib/models/AccountLineItem.js +3 -21
  10. package/lib/models/Action.js +3 -21
  11. package/lib/models/ActionNotificationExport.js +9 -61
  12. package/lib/models/ActionNotificationExportResult.js +6 -40
  13. package/lib/models/ActionWebhookFailure.js +5 -39
  14. package/lib/models/ApiKey.js +23 -128
  15. package/lib/models/App.js +6 -34
  16. package/lib/models/As2IncomingMessage.js +6 -36
  17. package/lib/models/As2OutgoingMessage.js +6 -36
  18. package/lib/models/As2Partner.js +16 -112
  19. package/lib/models/As2Station.js +16 -108
  20. package/lib/models/Auto.js +3 -21
  21. package/lib/models/Automation.js +16 -146
  22. package/lib/models/AutomationRun.js +9 -54
  23. package/lib/models/BandwidthSnapshot.js +6 -34
  24. package/lib/models/Behavior.js +22 -151
  25. package/lib/models/Bundle.js +61 -177
  26. package/lib/models/BundleDownload.js +6 -38
  27. package/lib/models/BundleRecipient.js +9 -62
  28. package/lib/models/BundleRegistration.js +6 -38
  29. package/lib/models/Clickwrap.js +16 -106
  30. package/lib/models/DnsRecord.js +6 -34
  31. package/lib/models/Errors.js +3 -21
  32. package/lib/models/ExternalEvent.js +12 -62
  33. package/lib/models/File.js +21 -271
  34. package/lib/models/FileAction.js +3 -21
  35. package/lib/models/FileComment.js +13 -94
  36. package/lib/models/FileCommentReaction.js +8 -55
  37. package/lib/models/FileMigration.js +6 -37
  38. package/lib/models/FileUploadPart.js +3 -21
  39. package/lib/models/Folder.js +9 -63
  40. package/lib/models/FormField.js +3 -21
  41. package/lib/models/FormFieldSet.js +16 -98
  42. package/lib/models/Group.js +16 -104
  43. package/lib/models/GroupUser.js +13 -108
  44. package/lib/models/History.js +18 -132
  45. package/lib/models/HistoryExport.js +9 -87
  46. package/lib/models/HistoryExportResult.js +6 -40
  47. package/lib/models/Image.js +3 -21
  48. package/lib/models/InboxRecipient.js +9 -62
  49. package/lib/models/InboxRegistration.js +6 -36
  50. package/lib/models/InboxUpload.js +6 -38
  51. package/lib/models/Invoice.js +9 -48
  52. package/lib/models/InvoiceLineItem.js +3 -21
  53. package/lib/models/IpAddress.js +9 -45
  54. package/lib/models/Lock.js +11 -82
  55. package/lib/models/Message.js +16 -124
  56. package/lib/models/MessageComment.js +16 -104
  57. package/lib/models/MessageCommentReaction.js +14 -82
  58. package/lib/models/MessageReaction.js +14 -82
  59. package/lib/models/Notification.js +16 -120
  60. package/lib/models/Payment.js +9 -48
  61. package/lib/models/PaymentLineItem.js +3 -21
  62. package/lib/models/Permission.js +11 -72
  63. package/lib/models/Preview.js +3 -21
  64. package/lib/models/Priority.js +6 -42
  65. package/lib/models/Project.js +16 -96
  66. package/lib/models/PublicIpAddress.js +3 -21
  67. package/lib/models/PublicKey.js +16 -104
  68. package/lib/models/RemoteBandwidthSnapshot.js +6 -34
  69. package/lib/models/RemoteServer.js +16 -270
  70. package/lib/models/Request.js +14 -89
  71. package/lib/models/Session.js +8 -41
  72. package/lib/models/SettingsChange.js +6 -34
  73. package/lib/models/SftpHostKey.js +16 -94
  74. package/lib/models/Site.js +10 -157
  75. package/lib/models/SsoStrategy.js +11 -64
  76. package/lib/models/Status.js +3 -21
  77. package/lib/models/Style.js +10 -73
  78. package/lib/models/UsageDailySnapshot.js +6 -34
  79. package/lib/models/UsageSnapshot.js +6 -34
  80. package/lib/models/User.js +22 -238
  81. package/lib/models/UserCipherUse.js +6 -36
  82. package/lib/models/UserRequest.js +14 -82
  83. package/lib/models/WebhookTest.js +6 -43
  84. package/lib/utils.js +0 -16
  85. package/package.json +1 -1
  86. package/src/models/Bundle.js +25 -0
@@ -1,46 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  exports.__esModule = true;
8
6
  exports.default = void 0;
9
-
10
7
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
-
16
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
-
20
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
-
22
13
  var _Api = _interopRequireDefault(require("../Api"));
23
-
24
14
  var errors = _interopRequireWildcard(require("../Errors"));
25
-
26
15
  var _Logger = _interopRequireDefault(require("../Logger"));
27
-
28
16
  var _utils = require("../utils");
29
-
30
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
-
32
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
-
34
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
-
36
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
-
38
21
  /**
39
22
  * Class Automation
40
- */
41
- var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
23
+ */var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
42
24
  var _this = this;
43
-
44
25
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
45
26
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46
27
  (0, _classCallCheck2.default)(this, Automation);
@@ -183,177 +164,135 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
183
164
  });
184
165
  (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
185
166
  var params,
186
- response,
187
- _args = arguments;
167
+ response,
168
+ _args = arguments;
188
169
  return _regenerator.default.wrap(function _callee$(_context) {
189
170
  while (1) {
190
171
  switch (_context.prev = _context.next) {
191
172
  case 0:
192
173
  params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
193
-
194
174
  if (_this.attributes.id) {
195
175
  _context.next = 3;
196
176
  break;
197
177
  }
198
-
199
178
  throw new errors.EmptyPropertyError('Current object has no id');
200
-
201
179
  case 3:
202
180
  if ((0, _utils.isObject)(params)) {
203
181
  _context.next = 5;
204
182
  break;
205
183
  }
206
-
207
184
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
208
-
209
185
  case 5:
210
186
  params.id = _this.attributes.id;
211
-
212
187
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
213
188
  _context.next = 8;
214
189
  break;
215
190
  }
216
-
217
191
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
218
-
219
192
  case 8:
220
193
  if (!(params['source'] && !(0, _utils.isString)(params['source']))) {
221
194
  _context.next = 10;
222
195
  break;
223
196
  }
224
-
225
197
  throw new errors.InvalidParameterError("Bad parameter: source must be of type String, received ".concat((0, _utils.getType)(source)));
226
-
227
198
  case 10:
228
199
  if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
229
200
  _context.next = 12;
230
201
  break;
231
202
  }
232
-
233
203
  throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
234
-
235
204
  case 12:
236
205
  if (!(params['destinations'] && !(0, _utils.isArray)(params['destinations']))) {
237
206
  _context.next = 14;
238
207
  break;
239
208
  }
240
-
241
209
  throw new errors.InvalidParameterError("Bad parameter: destinations must be of type Array, received ".concat((0, _utils.getType)(destinations)));
242
-
243
210
  case 14:
244
211
  if (!(params['destination_replace_from'] && !(0, _utils.isString)(params['destination_replace_from']))) {
245
212
  _context.next = 16;
246
213
  break;
247
214
  }
248
-
249
215
  throw new errors.InvalidParameterError("Bad parameter: destination_replace_from must be of type String, received ".concat((0, _utils.getType)(destination_replace_from)));
250
-
251
216
  case 16:
252
217
  if (!(params['destination_replace_to'] && !(0, _utils.isString)(params['destination_replace_to']))) {
253
218
  _context.next = 18;
254
219
  break;
255
220
  }
256
-
257
221
  throw new errors.InvalidParameterError("Bad parameter: destination_replace_to must be of type String, received ".concat((0, _utils.getType)(destination_replace_to)));
258
-
259
222
  case 18:
260
223
  if (!(params['interval'] && !(0, _utils.isString)(params['interval']))) {
261
224
  _context.next = 20;
262
225
  break;
263
226
  }
264
-
265
227
  throw new errors.InvalidParameterError("Bad parameter: interval must be of type String, received ".concat((0, _utils.getType)(interval)));
266
-
267
228
  case 20:
268
229
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
269
230
  _context.next = 22;
270
231
  break;
271
232
  }
272
-
273
233
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
274
-
275
234
  case 22:
276
235
  if (!(params['user_ids'] && !(0, _utils.isString)(params['user_ids']))) {
277
236
  _context.next = 24;
278
237
  break;
279
238
  }
280
-
281
239
  throw new errors.InvalidParameterError("Bad parameter: user_ids must be of type String, received ".concat((0, _utils.getType)(user_ids)));
282
-
283
240
  case 24:
284
241
  if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
285
242
  _context.next = 26;
286
243
  break;
287
244
  }
288
-
289
245
  throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(group_ids)));
290
-
291
246
  case 26:
292
247
  if (!(params['description'] && !(0, _utils.isString)(params['description']))) {
293
248
  _context.next = 28;
294
249
  break;
295
250
  }
296
-
297
251
  throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(description)));
298
-
299
252
  case 28:
300
253
  if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
301
254
  _context.next = 30;
302
255
  break;
303
256
  }
304
-
305
257
  throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
306
-
307
258
  case 30:
308
259
  if (!(params['trigger'] && !(0, _utils.isString)(params['trigger']))) {
309
260
  _context.next = 32;
310
261
  break;
311
262
  }
312
-
313
263
  throw new errors.InvalidParameterError("Bad parameter: trigger must be of type String, received ".concat((0, _utils.getType)(trigger)));
314
-
315
264
  case 32:
316
265
  if (!(params['trigger_actions'] && !(0, _utils.isArray)(params['trigger_actions']))) {
317
266
  _context.next = 34;
318
267
  break;
319
268
  }
320
-
321
269
  throw new errors.InvalidParameterError("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(trigger_actions)));
322
-
323
270
  case 34:
324
271
  if (!(params['automation'] && !(0, _utils.isString)(params['automation']))) {
325
272
  _context.next = 36;
326
273
  break;
327
274
  }
328
-
329
275
  throw new errors.InvalidParameterError("Bad parameter: automation must be of type String, received ".concat((0, _utils.getType)(automation)));
330
-
331
276
  case 36:
332
277
  if (params['id']) {
333
278
  _context.next = 42;
334
279
  break;
335
280
  }
336
-
337
281
  if (!_this.attributes.id) {
338
282
  _context.next = 41;
339
283
  break;
340
284
  }
341
-
342
285
  params['id'] = _this.id;
343
286
  _context.next = 42;
344
287
  break;
345
-
346
288
  case 41:
347
289
  throw new errors.MissingParameterError('Parameter missing: id');
348
-
349
290
  case 42:
350
291
  _context.next = 44;
351
292
  return _Api.default.sendRequest("/automations/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
352
-
353
293
  case 44:
354
294
  response = _context.sent;
355
295
  return _context.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, _this.options));
356
-
357
296
  case 46:
358
297
  case "end":
359
298
  return _context.stop();
@@ -363,65 +302,51 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
363
302
  })));
364
303
  (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
365
304
  var params,
366
- response,
367
- _args2 = arguments;
305
+ response,
306
+ _args2 = arguments;
368
307
  return _regenerator.default.wrap(function _callee2$(_context2) {
369
308
  while (1) {
370
309
  switch (_context2.prev = _context2.next) {
371
310
  case 0:
372
311
  params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
373
-
374
312
  if (_this.attributes.id) {
375
313
  _context2.next = 3;
376
314
  break;
377
315
  }
378
-
379
316
  throw new errors.EmptyPropertyError('Current object has no id');
380
-
381
317
  case 3:
382
318
  if ((0, _utils.isObject)(params)) {
383
319
  _context2.next = 5;
384
320
  break;
385
321
  }
386
-
387
322
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
388
-
389
323
  case 5:
390
324
  params.id = _this.attributes.id;
391
-
392
325
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
393
326
  _context2.next = 8;
394
327
  break;
395
328
  }
396
-
397
329
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
398
-
399
330
  case 8:
400
331
  if (params['id']) {
401
332
  _context2.next = 14;
402
333
  break;
403
334
  }
404
-
405
335
  if (!_this.attributes.id) {
406
336
  _context2.next = 13;
407
337
  break;
408
338
  }
409
-
410
339
  params['id'] = _this.id;
411
340
  _context2.next = 14;
412
341
  break;
413
-
414
342
  case 13:
415
343
  throw new errors.MissingParameterError('Parameter missing: id');
416
-
417
344
  case 14:
418
345
  _context2.next = 16;
419
346
  return _Api.default.sendRequest("/automations/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
420
-
421
347
  case 16:
422
348
  response = _context2.sent;
423
349
  return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
424
-
425
350
  case 18:
426
351
  case "end":
427
352
  return _context2.stop();
@@ -444,9 +369,8 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
444
369
  });
445
370
  Object.entries(attributes).forEach(function (_ref3) {
446
371
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
447
- key = _ref4[0],
448
- value = _ref4[1];
449
-
372
+ key = _ref4[0],
373
+ value = _ref4[1];
450
374
  var normalizedKey = key.replace('?', '');
451
375
  _this.attributes[normalizedKey] = value;
452
376
  Object.defineProperty(_this, normalizedKey, {
@@ -458,51 +382,41 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
458
382
  });
459
383
  (0, _defineProperty2.default)(Automation, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
460
384
  var _response$data;
461
-
462
385
  var params,
463
- options,
464
- response,
465
- _args3 = arguments;
386
+ options,
387
+ response,
388
+ _args3 = arguments;
466
389
  return _regenerator.default.wrap(function _callee3$(_context3) {
467
390
  while (1) {
468
391
  switch (_context3.prev = _context3.next) {
469
392
  case 0:
470
393
  params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
471
394
  options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
472
-
473
395
  if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
474
396
  _context3.next = 4;
475
397
  break;
476
398
  }
477
-
478
399
  throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
479
-
480
400
  case 4:
481
401
  if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
482
402
  _context3.next = 6;
483
403
  break;
484
404
  }
485
-
486
405
  throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
487
-
488
406
  case 6:
489
407
  if (!(params['automation'] && !(0, _utils.isString)(params['automation']))) {
490
408
  _context3.next = 8;
491
409
  break;
492
410
  }
493
-
494
411
  throw new errors.InvalidParameterError("Bad parameter: automation must be of type String, received ".concat((0, _utils.getType)(params['automation'])));
495
-
496
412
  case 8:
497
413
  _context3.next = 10;
498
414
  return _Api.default.sendRequest("/automations", 'GET', params, options);
499
-
500
415
  case 10:
501
416
  response = _context3.sent;
502
417
  return _context3.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) {
503
418
  return new Automation(obj, options);
504
419
  })) || []);
505
-
506
420
  case 12:
507
421
  case "end":
508
422
  return _context3.stop();
@@ -518,49 +432,39 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
518
432
  (0, _defineProperty2.default)(Automation, "find", /*#__PURE__*/function () {
519
433
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(id) {
520
434
  var params,
521
- options,
522
- response,
523
- _args4 = arguments;
435
+ options,
436
+ response,
437
+ _args4 = arguments;
524
438
  return _regenerator.default.wrap(function _callee4$(_context4) {
525
439
  while (1) {
526
440
  switch (_context4.prev = _context4.next) {
527
441
  case 0:
528
442
  params = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
529
443
  options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
530
-
531
444
  if ((0, _utils.isObject)(params)) {
532
445
  _context4.next = 4;
533
446
  break;
534
447
  }
535
-
536
448
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
537
-
538
449
  case 4:
539
450
  params['id'] = id;
540
-
541
451
  if (params['id']) {
542
452
  _context4.next = 7;
543
453
  break;
544
454
  }
545
-
546
455
  throw new errors.MissingParameterError('Parameter missing: id');
547
-
548
456
  case 7:
549
457
  if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
550
458
  _context4.next = 9;
551
459
  break;
552
460
  }
553
-
554
461
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
555
-
556
462
  case 9:
557
463
  _context4.next = 11;
558
464
  return _Api.default.sendRequest("/automations/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
559
-
560
465
  case 11:
561
466
  response = _context4.sent;
562
467
  return _context4.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, options));
563
-
564
468
  case 13:
565
469
  case "end":
566
470
  return _context4.stop();
@@ -568,7 +472,6 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
568
472
  }
569
473
  }, _callee4);
570
474
  }));
571
-
572
475
  return function (_x) {
573
476
  return _ref6.apply(this, arguments);
574
477
  };
@@ -580,143 +483,110 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
580
483
  });
581
484
  (0, _defineProperty2.default)(Automation, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
582
485
  var params,
583
- options,
584
- response,
585
- _args5 = arguments;
486
+ options,
487
+ response,
488
+ _args5 = arguments;
586
489
  return _regenerator.default.wrap(function _callee5$(_context5) {
587
490
  while (1) {
588
491
  switch (_context5.prev = _context5.next) {
589
492
  case 0:
590
493
  params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
591
494
  options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
592
-
593
495
  if (params['automation']) {
594
496
  _context5.next = 4;
595
497
  break;
596
498
  }
597
-
598
499
  throw new errors.MissingParameterError('Parameter missing: automation');
599
-
600
500
  case 4:
601
501
  if (!(params['source'] && !(0, _utils.isString)(params['source']))) {
602
502
  _context5.next = 6;
603
503
  break;
604
504
  }
605
-
606
505
  throw new errors.InvalidParameterError("Bad parameter: source must be of type String, received ".concat((0, _utils.getType)(params['source'])));
607
-
608
506
  case 6:
609
507
  if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
610
508
  _context5.next = 8;
611
509
  break;
612
510
  }
613
-
614
511
  throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(params['destination'])));
615
-
616
512
  case 8:
617
513
  if (!(params['destinations'] && !(0, _utils.isArray)(params['destinations']))) {
618
514
  _context5.next = 10;
619
515
  break;
620
516
  }
621
-
622
517
  throw new errors.InvalidParameterError("Bad parameter: destinations must be of type Array, received ".concat((0, _utils.getType)(params['destinations'])));
623
-
624
518
  case 10:
625
519
  if (!(params['destination_replace_from'] && !(0, _utils.isString)(params['destination_replace_from']))) {
626
520
  _context5.next = 12;
627
521
  break;
628
522
  }
629
-
630
523
  throw new errors.InvalidParameterError("Bad parameter: destination_replace_from must be of type String, received ".concat((0, _utils.getType)(params['destination_replace_from'])));
631
-
632
524
  case 12:
633
525
  if (!(params['destination_replace_to'] && !(0, _utils.isString)(params['destination_replace_to']))) {
634
526
  _context5.next = 14;
635
527
  break;
636
528
  }
637
-
638
529
  throw new errors.InvalidParameterError("Bad parameter: destination_replace_to must be of type String, received ".concat((0, _utils.getType)(params['destination_replace_to'])));
639
-
640
530
  case 14:
641
531
  if (!(params['interval'] && !(0, _utils.isString)(params['interval']))) {
642
532
  _context5.next = 16;
643
533
  break;
644
534
  }
645
-
646
535
  throw new errors.InvalidParameterError("Bad parameter: interval must be of type String, received ".concat((0, _utils.getType)(params['interval'])));
647
-
648
536
  case 16:
649
537
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
650
538
  _context5.next = 18;
651
539
  break;
652
540
  }
653
-
654
541
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
655
-
656
542
  case 18:
657
543
  if (!(params['user_ids'] && !(0, _utils.isString)(params['user_ids']))) {
658
544
  _context5.next = 20;
659
545
  break;
660
546
  }
661
-
662
547
  throw new errors.InvalidParameterError("Bad parameter: user_ids must be of type String, received ".concat((0, _utils.getType)(params['user_ids'])));
663
-
664
548
  case 20:
665
549
  if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
666
550
  _context5.next = 22;
667
551
  break;
668
552
  }
669
-
670
553
  throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(params['group_ids'])));
671
-
672
554
  case 22:
673
555
  if (!(params['description'] && !(0, _utils.isString)(params['description']))) {
674
556
  _context5.next = 24;
675
557
  break;
676
558
  }
677
-
678
559
  throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(params['description'])));
679
-
680
560
  case 24:
681
561
  if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
682
562
  _context5.next = 26;
683
563
  break;
684
564
  }
685
-
686
565
  throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
687
-
688
566
  case 26:
689
567
  if (!(params['trigger'] && !(0, _utils.isString)(params['trigger']))) {
690
568
  _context5.next = 28;
691
569
  break;
692
570
  }
693
-
694
571
  throw new errors.InvalidParameterError("Bad parameter: trigger must be of type String, received ".concat((0, _utils.getType)(params['trigger'])));
695
-
696
572
  case 28:
697
573
  if (!(params['trigger_actions'] && !(0, _utils.isArray)(params['trigger_actions']))) {
698
574
  _context5.next = 30;
699
575
  break;
700
576
  }
701
-
702
577
  throw new errors.InvalidParameterError("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(params['trigger_actions'])));
703
-
704
578
  case 30:
705
579
  if (!(params['automation'] && !(0, _utils.isString)(params['automation']))) {
706
580
  _context5.next = 32;
707
581
  break;
708
582
  }
709
-
710
583
  throw new errors.InvalidParameterError("Bad parameter: automation must be of type String, received ".concat((0, _utils.getType)(params['automation'])));
711
-
712
584
  case 32:
713
585
  _context5.next = 34;
714
586
  return _Api.default.sendRequest("/automations", 'POST', params, options);
715
-
716
587
  case 34:
717
588
  response = _context5.sent;
718
589
  return _context5.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, options));
719
-
720
590
  case 36:
721
591
  case "end":
722
592
  return _context5.stop();