files.com 1.0.285 → 1.0.286

Sign up to get free protection for your applications and to get access to all the features.
@@ -192,6 +192,34 @@ class Automation {
192
192
  }
193
193
 
194
194
 
195
+ // Manually run automation
196
+ manualRun = async (params = {}) => {
197
+ if (!this.attributes.id) {
198
+ throw new errors.EmptyPropertyError('Current object has no id')
199
+ }
200
+
201
+ if (!isObject(params)) {
202
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
203
+ }
204
+
205
+ params.id = this.attributes.id
206
+ if (params['id'] && !isInt(params['id'])) {
207
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
208
+ }
209
+
210
+ if (!params['id']) {
211
+ if (this.attributes.id) {
212
+ params['id'] = this.id
213
+ } else {
214
+ throw new errors.MissingParameterError('Parameter missing: id')
215
+ }
216
+ }
217
+
218
+ const response = await Api.sendRequest(`/automations/${encodeURIComponent(params['id'])}/manual_run`, 'POST', params, this.options)
219
+
220
+ return response?.data
221
+ }
222
+
195
223
  // Parameters:
196
224
  // source - string - Source Path
197
225
  // destination - string - DEPRECATED: Destination Path. Use `destinations` instead.