files.com 1.0.285 → 1.0.286
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 +1 -1
- package/docs/Errors.md +1 -0
- package/docs/models/Automation.md +15 -0
- package/lib/Errors.js +317 -303
- package/lib/models/Automation.js +161 -108
- package/package.json +1 -1
- package/src/Errors.js +1 -0
- package/src/models/Automation.js +28 -0
package/lib/models/Automation.js
CHANGED
@@ -199,6 +199,59 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
199
199
|
(0, _defineProperty2.default)(this, "setDestination", function (value) {
|
200
200
|
_this.attributes.destination = value;
|
201
201
|
});
|
202
|
+
// Manually run automation
|
203
|
+
(0, _defineProperty2.default)(this, "manualRun", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
204
|
+
var params,
|
205
|
+
response,
|
206
|
+
_args = arguments;
|
207
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
208
|
+
while (1) switch (_context.prev = _context.next) {
|
209
|
+
case 0:
|
210
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
211
|
+
if (_this.attributes.id) {
|
212
|
+
_context.next = 3;
|
213
|
+
break;
|
214
|
+
}
|
215
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
216
|
+
case 3:
|
217
|
+
if ((0, _utils.isObject)(params)) {
|
218
|
+
_context.next = 5;
|
219
|
+
break;
|
220
|
+
}
|
221
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
222
|
+
case 5:
|
223
|
+
params.id = _this.attributes.id;
|
224
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
225
|
+
_context.next = 8;
|
226
|
+
break;
|
227
|
+
}
|
228
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
229
|
+
case 8:
|
230
|
+
if (params['id']) {
|
231
|
+
_context.next = 14;
|
232
|
+
break;
|
233
|
+
}
|
234
|
+
if (!_this.attributes.id) {
|
235
|
+
_context.next = 13;
|
236
|
+
break;
|
237
|
+
}
|
238
|
+
params['id'] = _this.id;
|
239
|
+
_context.next = 14;
|
240
|
+
break;
|
241
|
+
case 13:
|
242
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
243
|
+
case 14:
|
244
|
+
_context.next = 16;
|
245
|
+
return _Api.default.sendRequest("/automations/".concat(encodeURIComponent(params['id']), "/manual_run"), 'POST', params, _this.options);
|
246
|
+
case 16:
|
247
|
+
response = _context.sent;
|
248
|
+
return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
249
|
+
case 18:
|
250
|
+
case "end":
|
251
|
+
return _context.stop();
|
252
|
+
}
|
253
|
+
}, _callee);
|
254
|
+
})));
|
202
255
|
// Parameters:
|
203
256
|
// source - string - Source Path
|
204
257
|
// destination - string - DEPRECATED: Destination Path. Use `destinations` instead.
|
@@ -219,205 +272,205 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
219
272
|
// value - object - A Hash of attributes specific to the automation type.
|
220
273
|
// recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
221
274
|
// automation - string - Automation type
|
222
|
-
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
275
|
+
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
223
276
|
var params,
|
224
277
|
response,
|
225
|
-
|
226
|
-
return _regenerator.default.wrap(function
|
227
|
-
while (1) switch (
|
278
|
+
_args2 = arguments;
|
279
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
280
|
+
while (1) switch (_context2.prev = _context2.next) {
|
228
281
|
case 0:
|
229
|
-
params =
|
282
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
230
283
|
if (_this.attributes.id) {
|
231
|
-
|
284
|
+
_context2.next = 3;
|
232
285
|
break;
|
233
286
|
}
|
234
287
|
throw new errors.EmptyPropertyError('Current object has no id');
|
235
288
|
case 3:
|
236
289
|
if ((0, _utils.isObject)(params)) {
|
237
|
-
|
290
|
+
_context2.next = 5;
|
238
291
|
break;
|
239
292
|
}
|
240
293
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
241
294
|
case 5:
|
242
295
|
params.id = _this.attributes.id;
|
243
296
|
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
244
|
-
|
297
|
+
_context2.next = 8;
|
245
298
|
break;
|
246
299
|
}
|
247
300
|
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
248
301
|
case 8:
|
249
302
|
if (!(params['source'] && !(0, _utils.isString)(params['source']))) {
|
250
|
-
|
303
|
+
_context2.next = 10;
|
251
304
|
break;
|
252
305
|
}
|
253
306
|
throw new errors.InvalidParameterError("Bad parameter: source must be of type String, received ".concat((0, _utils.getType)(source)));
|
254
307
|
case 10:
|
255
308
|
if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
|
256
|
-
|
309
|
+
_context2.next = 12;
|
257
310
|
break;
|
258
311
|
}
|
259
312
|
throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
|
260
313
|
case 12:
|
261
314
|
if (!(params['destinations'] && !(0, _utils.isArray)(params['destinations']))) {
|
262
|
-
|
315
|
+
_context2.next = 14;
|
263
316
|
break;
|
264
317
|
}
|
265
318
|
throw new errors.InvalidParameterError("Bad parameter: destinations must be of type Array, received ".concat((0, _utils.getType)(destinations)));
|
266
319
|
case 14:
|
267
320
|
if (!(params['destination_replace_from'] && !(0, _utils.isString)(params['destination_replace_from']))) {
|
268
|
-
|
321
|
+
_context2.next = 16;
|
269
322
|
break;
|
270
323
|
}
|
271
324
|
throw new errors.InvalidParameterError("Bad parameter: destination_replace_from must be of type String, received ".concat((0, _utils.getType)(destination_replace_from)));
|
272
325
|
case 16:
|
273
326
|
if (!(params['destination_replace_to'] && !(0, _utils.isString)(params['destination_replace_to']))) {
|
274
|
-
|
327
|
+
_context2.next = 18;
|
275
328
|
break;
|
276
329
|
}
|
277
330
|
throw new errors.InvalidParameterError("Bad parameter: destination_replace_to must be of type String, received ".concat((0, _utils.getType)(destination_replace_to)));
|
278
331
|
case 18:
|
279
332
|
if (!(params['interval'] && !(0, _utils.isString)(params['interval']))) {
|
280
|
-
|
333
|
+
_context2.next = 20;
|
281
334
|
break;
|
282
335
|
}
|
283
336
|
throw new errors.InvalidParameterError("Bad parameter: interval must be of type String, received ".concat((0, _utils.getType)(interval)));
|
284
337
|
case 20:
|
285
338
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
286
|
-
|
339
|
+
_context2.next = 22;
|
287
340
|
break;
|
288
341
|
}
|
289
342
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
290
343
|
case 22:
|
291
344
|
if (!(params['sync_ids'] && !(0, _utils.isString)(params['sync_ids']))) {
|
292
|
-
|
345
|
+
_context2.next = 24;
|
293
346
|
break;
|
294
347
|
}
|
295
348
|
throw new errors.InvalidParameterError("Bad parameter: sync_ids must be of type String, received ".concat((0, _utils.getType)(sync_ids)));
|
296
349
|
case 24:
|
297
350
|
if (!(params['user_ids'] && !(0, _utils.isString)(params['user_ids']))) {
|
298
|
-
|
351
|
+
_context2.next = 26;
|
299
352
|
break;
|
300
353
|
}
|
301
354
|
throw new errors.InvalidParameterError("Bad parameter: user_ids must be of type String, received ".concat((0, _utils.getType)(user_ids)));
|
302
355
|
case 26:
|
303
356
|
if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
|
304
|
-
|
357
|
+
_context2.next = 28;
|
305
358
|
break;
|
306
359
|
}
|
307
360
|
throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(group_ids)));
|
308
361
|
case 28:
|
309
362
|
if (!(params['description'] && !(0, _utils.isString)(params['description']))) {
|
310
|
-
|
363
|
+
_context2.next = 30;
|
311
364
|
break;
|
312
365
|
}
|
313
366
|
throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(description)));
|
314
367
|
case 30:
|
315
368
|
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
316
|
-
|
369
|
+
_context2.next = 32;
|
317
370
|
break;
|
318
371
|
}
|
319
372
|
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
320
373
|
case 32:
|
321
374
|
if (!(params['trigger'] && !(0, _utils.isString)(params['trigger']))) {
|
322
|
-
|
375
|
+
_context2.next = 34;
|
323
376
|
break;
|
324
377
|
}
|
325
378
|
throw new errors.InvalidParameterError("Bad parameter: trigger must be of type String, received ".concat((0, _utils.getType)(trigger)));
|
326
379
|
case 34:
|
327
380
|
if (!(params['trigger_actions'] && !(0, _utils.isArray)(params['trigger_actions']))) {
|
328
|
-
|
381
|
+
_context2.next = 36;
|
329
382
|
break;
|
330
383
|
}
|
331
384
|
throw new errors.InvalidParameterError("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(trigger_actions)));
|
332
385
|
case 36:
|
333
386
|
if (!(params['recurring_day'] && !(0, _utils.isInt)(params['recurring_day']))) {
|
334
|
-
|
387
|
+
_context2.next = 38;
|
335
388
|
break;
|
336
389
|
}
|
337
390
|
throw new errors.InvalidParameterError("Bad parameter: recurring_day must be of type Int, received ".concat((0, _utils.getType)(recurring_day)));
|
338
391
|
case 38:
|
339
392
|
if (!(params['automation'] && !(0, _utils.isString)(params['automation']))) {
|
340
|
-
|
393
|
+
_context2.next = 40;
|
341
394
|
break;
|
342
395
|
}
|
343
396
|
throw new errors.InvalidParameterError("Bad parameter: automation must be of type String, received ".concat((0, _utils.getType)(automation)));
|
344
397
|
case 40:
|
345
398
|
if (params['id']) {
|
346
|
-
|
399
|
+
_context2.next = 46;
|
347
400
|
break;
|
348
401
|
}
|
349
402
|
if (!_this.attributes.id) {
|
350
|
-
|
403
|
+
_context2.next = 45;
|
351
404
|
break;
|
352
405
|
}
|
353
406
|
params['id'] = _this.id;
|
354
|
-
|
407
|
+
_context2.next = 46;
|
355
408
|
break;
|
356
409
|
case 45:
|
357
410
|
throw new errors.MissingParameterError('Parameter missing: id');
|
358
411
|
case 46:
|
359
|
-
|
412
|
+
_context2.next = 48;
|
360
413
|
return _Api.default.sendRequest("/automations/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
|
361
414
|
case 48:
|
362
|
-
response =
|
363
|
-
return
|
415
|
+
response = _context2.sent;
|
416
|
+
return _context2.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
364
417
|
case 50:
|
365
418
|
case "end":
|
366
|
-
return
|
419
|
+
return _context2.stop();
|
367
420
|
}
|
368
|
-
},
|
421
|
+
}, _callee2);
|
369
422
|
})));
|
370
|
-
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
423
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
371
424
|
var params,
|
372
425
|
response,
|
373
|
-
|
374
|
-
return _regenerator.default.wrap(function
|
375
|
-
while (1) switch (
|
426
|
+
_args3 = arguments;
|
427
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
428
|
+
while (1) switch (_context3.prev = _context3.next) {
|
376
429
|
case 0:
|
377
|
-
params =
|
430
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
378
431
|
if (_this.attributes.id) {
|
379
|
-
|
432
|
+
_context3.next = 3;
|
380
433
|
break;
|
381
434
|
}
|
382
435
|
throw new errors.EmptyPropertyError('Current object has no id');
|
383
436
|
case 3:
|
384
437
|
if ((0, _utils.isObject)(params)) {
|
385
|
-
|
438
|
+
_context3.next = 5;
|
386
439
|
break;
|
387
440
|
}
|
388
441
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
389
442
|
case 5:
|
390
443
|
params.id = _this.attributes.id;
|
391
444
|
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
392
|
-
|
445
|
+
_context3.next = 8;
|
393
446
|
break;
|
394
447
|
}
|
395
448
|
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
396
449
|
case 8:
|
397
450
|
if (params['id']) {
|
398
|
-
|
451
|
+
_context3.next = 14;
|
399
452
|
break;
|
400
453
|
}
|
401
454
|
if (!_this.attributes.id) {
|
402
|
-
|
455
|
+
_context3.next = 13;
|
403
456
|
break;
|
404
457
|
}
|
405
458
|
params['id'] = _this.id;
|
406
|
-
|
459
|
+
_context3.next = 14;
|
407
460
|
break;
|
408
461
|
case 13:
|
409
462
|
throw new errors.MissingParameterError('Parameter missing: id');
|
410
463
|
case 14:
|
411
|
-
|
464
|
+
_context3.next = 16;
|
412
465
|
return _Api.default.sendRequest("/automations/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
|
413
466
|
case 16:
|
414
|
-
response =
|
415
|
-
return
|
467
|
+
response = _context3.sent;
|
468
|
+
return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
416
469
|
case 18:
|
417
470
|
case "end":
|
418
|
-
return
|
471
|
+
return _context3.stop();
|
419
472
|
}
|
420
|
-
},
|
473
|
+
}, _callee3);
|
421
474
|
})));
|
422
475
|
(0, _defineProperty2.default)(this, "destroy", function () {
|
423
476
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -432,10 +485,10 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
432
485
|
return true;
|
433
486
|
}
|
434
487
|
});
|
435
|
-
Object.entries(attributes).forEach(function (
|
436
|
-
var
|
437
|
-
key =
|
438
|
-
value =
|
488
|
+
Object.entries(attributes).forEach(function (_ref4) {
|
489
|
+
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
490
|
+
key = _ref5[0],
|
491
|
+
value = _ref5[1];
|
439
492
|
var normalizedKey = key.replace('?', '');
|
440
493
|
_this.attributes[normalizedKey] = value;
|
441
494
|
Object.defineProperty(_this, normalizedKey, {
|
@@ -455,41 +508,41 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
455
508
|
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `last_modified_at`.
|
456
509
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `last_modified_at`.
|
457
510
|
// with_deleted - boolean - Set to true to include deleted automations in the results.
|
458
|
-
(0, _defineProperty2.default)(Automation, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
511
|
+
(0, _defineProperty2.default)(Automation, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
459
512
|
var _response$data;
|
460
513
|
var params,
|
461
514
|
options,
|
462
515
|
response,
|
463
|
-
|
464
|
-
return _regenerator.default.wrap(function
|
465
|
-
while (1) switch (
|
516
|
+
_args4 = arguments;
|
517
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
518
|
+
while (1) switch (_context4.prev = _context4.next) {
|
466
519
|
case 0:
|
467
|
-
params =
|
468
|
-
options =
|
520
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
521
|
+
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
469
522
|
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
470
|
-
|
523
|
+
_context4.next = 4;
|
471
524
|
break;
|
472
525
|
}
|
473
526
|
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
|
474
527
|
case 4:
|
475
528
|
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
476
|
-
|
529
|
+
_context4.next = 6;
|
477
530
|
break;
|
478
531
|
}
|
479
532
|
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
|
480
533
|
case 6:
|
481
|
-
|
534
|
+
_context4.next = 8;
|
482
535
|
return _Api.default.sendRequest("/automations", 'GET', params, options);
|
483
536
|
case 8:
|
484
|
-
response =
|
485
|
-
return
|
537
|
+
response = _context4.sent;
|
538
|
+
return _context4.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) {
|
486
539
|
return new Automation(obj, options);
|
487
540
|
})) || []);
|
488
541
|
case 10:
|
489
542
|
case "end":
|
490
|
-
return
|
543
|
+
return _context4.stop();
|
491
544
|
}
|
492
|
-
},
|
545
|
+
}, _callee4);
|
493
546
|
})));
|
494
547
|
(0, _defineProperty2.default)(Automation, "all", function () {
|
495
548
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -499,48 +552,48 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
499
552
|
// Parameters:
|
500
553
|
// id (required) - int64 - Automation ID.
|
501
554
|
(0, _defineProperty2.default)(Automation, "find", /*#__PURE__*/function () {
|
502
|
-
var
|
555
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
|
503
556
|
var params,
|
504
557
|
options,
|
505
558
|
response,
|
506
|
-
|
507
|
-
return _regenerator.default.wrap(function
|
508
|
-
while (1) switch (
|
559
|
+
_args5 = arguments;
|
560
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
561
|
+
while (1) switch (_context5.prev = _context5.next) {
|
509
562
|
case 0:
|
510
|
-
params =
|
511
|
-
options =
|
563
|
+
params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
564
|
+
options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
|
512
565
|
if ((0, _utils.isObject)(params)) {
|
513
|
-
|
566
|
+
_context5.next = 4;
|
514
567
|
break;
|
515
568
|
}
|
516
569
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
517
570
|
case 4:
|
518
571
|
params['id'] = id;
|
519
572
|
if (params['id']) {
|
520
|
-
|
573
|
+
_context5.next = 7;
|
521
574
|
break;
|
522
575
|
}
|
523
576
|
throw new errors.MissingParameterError('Parameter missing: id');
|
524
577
|
case 7:
|
525
578
|
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
526
|
-
|
579
|
+
_context5.next = 9;
|
527
580
|
break;
|
528
581
|
}
|
529
582
|
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
|
530
583
|
case 9:
|
531
|
-
|
584
|
+
_context5.next = 11;
|
532
585
|
return _Api.default.sendRequest("/automations/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
|
533
586
|
case 11:
|
534
|
-
response =
|
535
|
-
return
|
587
|
+
response = _context5.sent;
|
588
|
+
return _context5.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, options));
|
536
589
|
case 13:
|
537
590
|
case "end":
|
538
|
-
return
|
591
|
+
return _context5.stop();
|
539
592
|
}
|
540
|
-
},
|
593
|
+
}, _callee5);
|
541
594
|
}));
|
542
595
|
return function (_x) {
|
543
|
-
return
|
596
|
+
return _ref7.apply(this, arguments);
|
544
597
|
};
|
545
598
|
}());
|
546
599
|
(0, _defineProperty2.default)(Automation, "get", function (id) {
|
@@ -568,128 +621,128 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
568
621
|
// value - object - A Hash of attributes specific to the automation type.
|
569
622
|
// recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
|
570
623
|
// automation (required) - string - Automation type
|
571
|
-
(0, _defineProperty2.default)(Automation, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
624
|
+
(0, _defineProperty2.default)(Automation, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
572
625
|
var params,
|
573
626
|
options,
|
574
627
|
response,
|
575
|
-
|
576
|
-
return _regenerator.default.wrap(function
|
577
|
-
while (1) switch (
|
628
|
+
_args6 = arguments;
|
629
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
630
|
+
while (1) switch (_context6.prev = _context6.next) {
|
578
631
|
case 0:
|
579
|
-
params =
|
580
|
-
options =
|
632
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
633
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
581
634
|
if (params['automation']) {
|
582
|
-
|
635
|
+
_context6.next = 4;
|
583
636
|
break;
|
584
637
|
}
|
585
638
|
throw new errors.MissingParameterError('Parameter missing: automation');
|
586
639
|
case 4:
|
587
640
|
if (!(params['source'] && !(0, _utils.isString)(params['source']))) {
|
588
|
-
|
641
|
+
_context6.next = 6;
|
589
642
|
break;
|
590
643
|
}
|
591
644
|
throw new errors.InvalidParameterError("Bad parameter: source must be of type String, received ".concat((0, _utils.getType)(params['source'])));
|
592
645
|
case 6:
|
593
646
|
if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
|
594
|
-
|
647
|
+
_context6.next = 8;
|
595
648
|
break;
|
596
649
|
}
|
597
650
|
throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(params['destination'])));
|
598
651
|
case 8:
|
599
652
|
if (!(params['destinations'] && !(0, _utils.isArray)(params['destinations']))) {
|
600
|
-
|
653
|
+
_context6.next = 10;
|
601
654
|
break;
|
602
655
|
}
|
603
656
|
throw new errors.InvalidParameterError("Bad parameter: destinations must be of type Array, received ".concat((0, _utils.getType)(params['destinations'])));
|
604
657
|
case 10:
|
605
658
|
if (!(params['destination_replace_from'] && !(0, _utils.isString)(params['destination_replace_from']))) {
|
606
|
-
|
659
|
+
_context6.next = 12;
|
607
660
|
break;
|
608
661
|
}
|
609
662
|
throw new errors.InvalidParameterError("Bad parameter: destination_replace_from must be of type String, received ".concat((0, _utils.getType)(params['destination_replace_from'])));
|
610
663
|
case 12:
|
611
664
|
if (!(params['destination_replace_to'] && !(0, _utils.isString)(params['destination_replace_to']))) {
|
612
|
-
|
665
|
+
_context6.next = 14;
|
613
666
|
break;
|
614
667
|
}
|
615
668
|
throw new errors.InvalidParameterError("Bad parameter: destination_replace_to must be of type String, received ".concat((0, _utils.getType)(params['destination_replace_to'])));
|
616
669
|
case 14:
|
617
670
|
if (!(params['interval'] && !(0, _utils.isString)(params['interval']))) {
|
618
|
-
|
671
|
+
_context6.next = 16;
|
619
672
|
break;
|
620
673
|
}
|
621
674
|
throw new errors.InvalidParameterError("Bad parameter: interval must be of type String, received ".concat((0, _utils.getType)(params['interval'])));
|
622
675
|
case 16:
|
623
676
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
624
|
-
|
677
|
+
_context6.next = 18;
|
625
678
|
break;
|
626
679
|
}
|
627
680
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
628
681
|
case 18:
|
629
682
|
if (!(params['sync_ids'] && !(0, _utils.isString)(params['sync_ids']))) {
|
630
|
-
|
683
|
+
_context6.next = 20;
|
631
684
|
break;
|
632
685
|
}
|
633
686
|
throw new errors.InvalidParameterError("Bad parameter: sync_ids must be of type String, received ".concat((0, _utils.getType)(params['sync_ids'])));
|
634
687
|
case 20:
|
635
688
|
if (!(params['user_ids'] && !(0, _utils.isString)(params['user_ids']))) {
|
636
|
-
|
689
|
+
_context6.next = 22;
|
637
690
|
break;
|
638
691
|
}
|
639
692
|
throw new errors.InvalidParameterError("Bad parameter: user_ids must be of type String, received ".concat((0, _utils.getType)(params['user_ids'])));
|
640
693
|
case 22:
|
641
694
|
if (!(params['group_ids'] && !(0, _utils.isString)(params['group_ids']))) {
|
642
|
-
|
695
|
+
_context6.next = 24;
|
643
696
|
break;
|
644
697
|
}
|
645
698
|
throw new errors.InvalidParameterError("Bad parameter: group_ids must be of type String, received ".concat((0, _utils.getType)(params['group_ids'])));
|
646
699
|
case 24:
|
647
700
|
if (!(params['description'] && !(0, _utils.isString)(params['description']))) {
|
648
|
-
|
701
|
+
_context6.next = 26;
|
649
702
|
break;
|
650
703
|
}
|
651
704
|
throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(params['description'])));
|
652
705
|
case 26:
|
653
706
|
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
654
|
-
|
707
|
+
_context6.next = 28;
|
655
708
|
break;
|
656
709
|
}
|
657
710
|
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
|
658
711
|
case 28:
|
659
712
|
if (!(params['trigger'] && !(0, _utils.isString)(params['trigger']))) {
|
660
|
-
|
713
|
+
_context6.next = 30;
|
661
714
|
break;
|
662
715
|
}
|
663
716
|
throw new errors.InvalidParameterError("Bad parameter: trigger must be of type String, received ".concat((0, _utils.getType)(params['trigger'])));
|
664
717
|
case 30:
|
665
718
|
if (!(params['trigger_actions'] && !(0, _utils.isArray)(params['trigger_actions']))) {
|
666
|
-
|
719
|
+
_context6.next = 32;
|
667
720
|
break;
|
668
721
|
}
|
669
722
|
throw new errors.InvalidParameterError("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(params['trigger_actions'])));
|
670
723
|
case 32:
|
671
724
|
if (!(params['recurring_day'] && !(0, _utils.isInt)(params['recurring_day']))) {
|
672
|
-
|
725
|
+
_context6.next = 34;
|
673
726
|
break;
|
674
727
|
}
|
675
728
|
throw new errors.InvalidParameterError("Bad parameter: recurring_day must be of type Int, received ".concat((0, _utils.getType)(params['recurring_day'])));
|
676
729
|
case 34:
|
677
730
|
if (!(params['automation'] && !(0, _utils.isString)(params['automation']))) {
|
678
|
-
|
731
|
+
_context6.next = 36;
|
679
732
|
break;
|
680
733
|
}
|
681
734
|
throw new errors.InvalidParameterError("Bad parameter: automation must be of type String, received ".concat((0, _utils.getType)(params['automation'])));
|
682
735
|
case 36:
|
683
|
-
|
736
|
+
_context6.next = 38;
|
684
737
|
return _Api.default.sendRequest("/automations", 'POST', params, options);
|
685
738
|
case 38:
|
686
|
-
response =
|
687
|
-
return
|
739
|
+
response = _context6.sent;
|
740
|
+
return _context6.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, options));
|
688
741
|
case 40:
|
689
742
|
case "end":
|
690
|
-
return
|
743
|
+
return _context6.stop();
|
691
744
|
}
|
692
|
-
},
|
745
|
+
}, _callee6);
|
693
746
|
})));
|
694
747
|
var _default = Automation;
|
695
748
|
exports.default = _default;
|
package/package.json
CHANGED
package/src/Errors.js
CHANGED
@@ -185,6 +185,7 @@ export class NotFound_NestedNotFoundError extends NotFoundError { constructor(me
|
|
185
185
|
export class NotFound_PlanNotFoundError extends NotFoundError { constructor(message, code) { super(message, code); this.name = 'NotFound_PlanNotFoundError' } } errorClasses.NotFound_PlanNotFoundError = NotFound_PlanNotFoundError
|
186
186
|
export class NotFound_SiteNotFoundError extends NotFoundError { constructor(message, code) { super(message, code); this.name = 'NotFound_SiteNotFoundError' } } errorClasses.NotFound_SiteNotFoundError = NotFound_SiteNotFoundError
|
187
187
|
export class NotFound_UserNotFoundError extends NotFoundError { constructor(message, code) { super(message, code); this.name = 'NotFound_UserNotFoundError' } } errorClasses.NotFound_UserNotFoundError = NotFound_UserNotFoundError
|
188
|
+
export class ProcessingFailure_AutomationCannotBeRunManuallyError extends ProcessingFailureError { constructor(message, code) { super(message, code); this.name = 'ProcessingFailure_AutomationCannotBeRunManuallyError' } } errorClasses.ProcessingFailure_AutomationCannotBeRunManuallyError = ProcessingFailure_AutomationCannotBeRunManuallyError
|
188
189
|
export class ProcessingFailure_BundleOnlyAllowsPreviewsError extends ProcessingFailureError { constructor(message, code) { super(message, code); this.name = 'ProcessingFailure_BundleOnlyAllowsPreviewsError' } } errorClasses.ProcessingFailure_BundleOnlyAllowsPreviewsError = ProcessingFailure_BundleOnlyAllowsPreviewsError
|
189
190
|
export class ProcessingFailure_BundleOperationRequiresSubfolderError extends ProcessingFailureError { constructor(message, code) { super(message, code); this.name = 'ProcessingFailure_BundleOperationRequiresSubfolderError' } } errorClasses.ProcessingFailure_BundleOperationRequiresSubfolderError = ProcessingFailure_BundleOperationRequiresSubfolderError
|
190
191
|
export class ProcessingFailure_CouldNotCreateParentError extends ProcessingFailureError { constructor(message, code) { super(message, code); this.name = 'ProcessingFailure_CouldNotCreateParentError' } } errorClasses.ProcessingFailure_CouldNotCreateParentError = ProcessingFailure_CouldNotCreateParentError
|