files.com 1.0.151 → 1.0.152
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/lib/models/Automation.js +36 -14
- package/package.json +1 -1
- package/src/models/Automation.js +16 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.152
|
package/lib/models/Automation.js
CHANGED
@@ -143,6 +143,12 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
143
143
|
(0, _defineProperty2.default)(this, "setTriggerActions", function (value) {
|
144
144
|
_this.attributes.trigger_actions = value;
|
145
145
|
});
|
146
|
+
(0, _defineProperty2.default)(this, "getTriggerActionPath", function () {
|
147
|
+
return _this.attributes.trigger_action_path;
|
148
|
+
});
|
149
|
+
(0, _defineProperty2.default)(this, "setTriggerActionPath", function (value) {
|
150
|
+
_this.attributes.trigger_action_path = value;
|
151
|
+
});
|
146
152
|
(0, _defineProperty2.default)(this, "getValue", function () {
|
147
153
|
return _this.attributes.value;
|
148
154
|
});
|
@@ -302,45 +308,53 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
302
308
|
throw new Error("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(trigger_actions)));
|
303
309
|
|
304
310
|
case 36:
|
311
|
+
if (!(params['trigger_action_path'] && !(0, _utils.isString)(params['trigger_action_path']))) {
|
312
|
+
_context.next = 38;
|
313
|
+
break;
|
314
|
+
}
|
315
|
+
|
316
|
+
throw new Error("Bad parameter: trigger_action_path must be of type String, received ".concat((0, _utils.getType)(trigger_action_path)));
|
317
|
+
|
318
|
+
case 38:
|
305
319
|
if (params['id']) {
|
306
|
-
_context.next =
|
320
|
+
_context.next = 44;
|
307
321
|
break;
|
308
322
|
}
|
309
323
|
|
310
324
|
if (!_this.attributes.id) {
|
311
|
-
_context.next =
|
325
|
+
_context.next = 43;
|
312
326
|
break;
|
313
327
|
}
|
314
328
|
|
315
329
|
params['id'] = _this.id;
|
316
|
-
_context.next =
|
330
|
+
_context.next = 44;
|
317
331
|
break;
|
318
332
|
|
319
|
-
case
|
333
|
+
case 43:
|
320
334
|
throw new Error('Parameter missing: id');
|
321
335
|
|
322
|
-
case
|
336
|
+
case 44:
|
323
337
|
if (params['automation']) {
|
324
|
-
_context.next =
|
338
|
+
_context.next = 50;
|
325
339
|
break;
|
326
340
|
}
|
327
341
|
|
328
342
|
if (!_this.attributes.automation) {
|
329
|
-
_context.next =
|
343
|
+
_context.next = 49;
|
330
344
|
break;
|
331
345
|
}
|
332
346
|
|
333
347
|
params['automation'] = _this.automation;
|
334
|
-
_context.next =
|
348
|
+
_context.next = 50;
|
335
349
|
break;
|
336
350
|
|
337
|
-
case
|
351
|
+
case 49:
|
338
352
|
throw new Error('Parameter missing: automation');
|
339
353
|
|
340
|
-
case
|
354
|
+
case 50:
|
341
355
|
return _context.abrupt("return", _Api.default.sendRequest("/automations/".concat(params['id']), 'PATCH', params, _this.options));
|
342
356
|
|
343
|
-
case
|
357
|
+
case 51:
|
344
358
|
case "end":
|
345
359
|
return _context.stop();
|
346
360
|
}
|
@@ -690,14 +704,22 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
690
704
|
throw new Error("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(trigger_actions)));
|
691
705
|
|
692
706
|
case 32:
|
693
|
-
|
694
|
-
|
707
|
+
if (!(params['trigger_action_path'] && !(0, _utils.isString)(params['trigger_action_path']))) {
|
708
|
+
_context5.next = 34;
|
709
|
+
break;
|
710
|
+
}
|
711
|
+
|
712
|
+
throw new Error("Bad parameter: trigger_action_path must be of type String, received ".concat((0, _utils.getType)(trigger_action_path)));
|
695
713
|
|
696
714
|
case 34:
|
715
|
+
_context5.next = 36;
|
716
|
+
return _Api.default.sendRequest("/automations", 'POST', params, options);
|
717
|
+
|
718
|
+
case 36:
|
697
719
|
response = _context5.sent;
|
698
720
|
return _context5.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, options));
|
699
721
|
|
700
|
-
case
|
722
|
+
case 38:
|
701
723
|
case "end":
|
702
724
|
return _context5.stop();
|
703
725
|
}
|
package/package.json
CHANGED
package/src/models/Automation.js
CHANGED
@@ -141,6 +141,13 @@ class Automation {
|
|
141
141
|
this.attributes.trigger_actions = value
|
142
142
|
}
|
143
143
|
|
144
|
+
// string # If trigger is `action`, this is the path to watch for the specified trigger actions.
|
145
|
+
getTriggerActionPath = () => this.attributes.trigger_action_path
|
146
|
+
|
147
|
+
setTriggerActionPath = value => {
|
148
|
+
this.attributes.trigger_action_path = value
|
149
|
+
}
|
150
|
+
|
144
151
|
// object # A Hash of attributes specific to the automation type.
|
145
152
|
getValue = () => this.attributes.value
|
146
153
|
|
@@ -172,6 +179,7 @@ class Automation {
|
|
172
179
|
// name - string - Name for this automation.
|
173
180
|
// trigger - string - How this automation is triggered to run. One of: `realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
|
174
181
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
182
|
+
// trigger_action_path - string - If trigger is `action`, this is the path to watch for the specified trigger actions.
|
175
183
|
// value - object - A Hash of attributes specific to the automation type.
|
176
184
|
update = async (params = {}) => {
|
177
185
|
if (!this.attributes.id) {
|
@@ -228,6 +236,9 @@ class Automation {
|
|
228
236
|
if (params['trigger_actions'] && !isArray(params['trigger_actions'])) {
|
229
237
|
throw new Error(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
|
230
238
|
}
|
239
|
+
if (params['trigger_action_path'] && !isString(params['trigger_action_path'])) {
|
240
|
+
throw new Error(`Bad parameter: trigger_action_path must be of type String, received ${getType(trigger_action_path)}`)
|
241
|
+
}
|
231
242
|
|
232
243
|
if (!params['id']) {
|
233
244
|
if (this.attributes.id) {
|
@@ -359,6 +370,7 @@ class Automation {
|
|
359
370
|
// name - string - Name for this automation.
|
360
371
|
// trigger - string - How this automation is triggered to run. One of: `realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
|
361
372
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
373
|
+
// trigger_action_path - string - If trigger is `action`, this is the path to watch for the specified trigger actions.
|
362
374
|
// value - object - A Hash of attributes specific to the automation type.
|
363
375
|
static create = async (params = {}, options = {}) => {
|
364
376
|
if (!params['automation']) {
|
@@ -421,6 +433,10 @@ class Automation {
|
|
421
433
|
throw new Error(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
|
422
434
|
}
|
423
435
|
|
436
|
+
if (params['trigger_action_path'] && !isString(params['trigger_action_path'])) {
|
437
|
+
throw new Error(`Bad parameter: trigger_action_path must be of type String, received ${getType(trigger_action_path)}`)
|
438
|
+
}
|
439
|
+
|
424
440
|
const response = await Api.sendRequest(`/automations`, 'POST', params, options)
|
425
441
|
|
426
442
|
return new Automation(response?.data, options)
|