ittybit 0.7.5.2 → 0.8.0
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.
- checksums.yaml +4 -4
- data/lib/ittybit/automations/client.rb +149 -87
- data/lib/ittybit/automations/types/update_automation_request_status.rb +10 -0
- data/lib/ittybit/automations/types/{automations_update_request_trigger_conditions_item.rb → update_automation_request_trigger.rb} +19 -21
- data/lib/ittybit/files/client.rb +67 -77
- data/lib/ittybit/media/client.rb +78 -34
- data/lib/ittybit/signatures/client.rb +20 -24
- data/lib/ittybit/signatures/types/signatures_create_request_method.rb +0 -3
- data/lib/ittybit/tasks/client.rb +45 -132
- data/lib/ittybit/types/automation.rb +19 -29
- data/lib/ittybit/types/automation_list_response.rb +15 -2
- data/lib/ittybit/types/automation_response.rb +15 -2
- data/lib/ittybit/types/automation_status.rb +1 -3
- data/lib/ittybit/types/automation_trigger.rb +11 -18
- data/lib/ittybit/types/{confirmation_response_data.rb → confirmation.rb} +11 -9
- data/lib/ittybit/types/confirmation_response.rb +20 -7
- data/lib/ittybit/types/file.rb +64 -68
- data/lib/ittybit/types/file_kind.rb +0 -1
- data/lib/ittybit/types/file_list_response.rb +15 -2
- data/lib/ittybit/types/file_object.rb +0 -1
- data/lib/ittybit/types/file_response.rb +15 -2
- data/lib/ittybit/types/file_status.rb +0 -1
- data/lib/ittybit/types/links.rb +4 -4
- data/lib/ittybit/types/links_list.rb +17 -32
- data/lib/ittybit/types/media.rb +34 -56
- data/lib/ittybit/types/media_kind.rb +0 -1
- data/lib/ittybit/types/media_list_response.rb +15 -2
- data/lib/ittybit/types/media_response.rb +15 -2
- data/lib/ittybit/types/media_source.rb +52 -53
- data/lib/ittybit/types/media_source_kind.rb +0 -1
- data/lib/ittybit/types/media_source_object.rb +0 -1
- data/lib/ittybit/types/media_source_orientation.rb +9 -0
- data/lib/ittybit/types/media_source_status.rb +0 -1
- data/lib/ittybit/types/meta_list.rb +40 -15
- data/lib/ittybit/types/meta_list_type.rb +8 -0
- data/lib/ittybit/types/signature.rb +14 -14
- data/lib/ittybit/types/signature_response.rb +15 -2
- data/lib/ittybit/types/task.rb +30 -50
- data/lib/ittybit/types/task_list_response.rb +15 -2
- data/lib/ittybit/types/task_response.rb +15 -2
- data/lib/ittybit/types/task_status.rb +0 -1
- data/lib/ittybit/types/task_summary.rb +20 -20
- data/lib/ittybit/types/task_summary_kind.rb +9 -13
- data/lib/ittybit/types/task_summary_status.rb +0 -1
- data/lib/ittybit/types/workflow_task_step.rb +22 -55
- data/lib/ittybit/types/workflow_task_step_kind.rb +8 -14
- data/lib/ittybit/types/{error_response.rb → workflow_task_step_next_item.rb} +21 -28
- data/lib/ittybit.rb +2 -2
- data/lib/requests.rb +8 -8
- data/lib/types_export.rb +6 -11
- metadata +8 -13
- data/lib/ittybit/automations/types/automations_update_request_trigger.rb +0 -75
- data/lib/ittybit/files/types/files_delete_response.rb +0 -89
- data/lib/ittybit/files/types/files_delete_response_data.rb +0 -60
- data/lib/ittybit/tasks/types/tasks_create_request_kind.rb +0 -22
- data/lib/ittybit/tasks/types/tasks_list_request_kind.rb +0 -26
- data/lib/ittybit/tasks/types/tasks_list_request_status.rb +0 -16
- data/lib/ittybit/types/automation_trigger_conditions_item.rb +0 -65
- data/lib/ittybit/types/media_urls.rb +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60b6f9eaf8ba438c86b11906591ad185931f0bb50617f05472350a5a5e745cc4
|
4
|
+
data.tar.gz: ab598d69391173fc1f981f1b0b1ee08d324c941431da6e4279e46dbfb97fe65e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 518a4daa7c1e1fad6d2dc5d558ff870faa15842b104ca8710d457f379989e23cd5a62505d8542a1902b6d1a97df7d21500b4b8e474b839b190b530a48736ce77
|
7
|
+
data.tar.gz: 896025ab3aaec1237044ca7b0001127a68803ed03dba50328cd081a0c4efb5b7330c62a1d6294bd1355feb3a3bc1bf8d394d898aa48c9768c6d5f648b4dff8a7
|
@@ -3,8 +3,10 @@
|
|
3
3
|
require_relative "../../requests"
|
4
4
|
require_relative "../types/automation_list_response"
|
5
5
|
require_relative "../types/automation_response"
|
6
|
-
require_relative "types/
|
6
|
+
require_relative "../types/confirmation_response"
|
7
|
+
require_relative "types/update_automation_request_trigger"
|
7
8
|
require_relative "../types/workflow_task_step"
|
9
|
+
require_relative "types/update_automation_request_status"
|
8
10
|
require "async"
|
9
11
|
|
10
12
|
module Ittybit
|
@@ -18,8 +20,9 @@ module Ittybit
|
|
18
20
|
@request_client = request_client
|
19
21
|
end
|
20
22
|
|
21
|
-
# Retrieves a list of all automations for the current project
|
23
|
+
# Retrieves a paginated list of all automations for the current project
|
22
24
|
#
|
25
|
+
# @param limit [Integer]
|
23
26
|
# @param request_options [Ittybit::RequestOptions]
|
24
27
|
# @return [Ittybit::AutomationListResponse]
|
25
28
|
# @example
|
@@ -29,7 +32,7 @@ module Ittybit
|
|
29
32
|
# token: "YOUR_AUTH_TOKEN"
|
30
33
|
# )
|
31
34
|
# api.automations.list
|
32
|
-
def list(request_options: nil)
|
35
|
+
def list(limit: nil, request_options: nil)
|
33
36
|
response = @request_client.conn.get do |req|
|
34
37
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
35
38
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
@@ -39,9 +42,7 @@ module Ittybit
|
|
39
42
|
**@request_client.get_headers,
|
40
43
|
**(request_options&.additional_headers || {})
|
41
44
|
}.compact
|
42
|
-
|
43
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
44
|
-
end
|
45
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit }.compact
|
45
46
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
46
47
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
47
48
|
end
|
@@ -50,7 +51,7 @@ module Ittybit
|
|
50
51
|
Ittybit::AutomationListResponse.from_json(json_object: response.body)
|
51
52
|
end
|
52
53
|
|
53
|
-
# Creates a new automation
|
54
|
+
# Creates a new automation.
|
54
55
|
#
|
55
56
|
# @param request_options [Ittybit::RequestOptions]
|
56
57
|
# @return [Ittybit::AutomationResponse]
|
@@ -82,7 +83,7 @@ module Ittybit
|
|
82
83
|
Ittybit::AutomationResponse.from_json(json_object: response.body)
|
83
84
|
end
|
84
85
|
|
85
|
-
#
|
86
|
+
# Retrieve the automation object for a automation with the given ID.
|
86
87
|
#
|
87
88
|
# @param id [String]
|
88
89
|
# @param request_options [Ittybit::RequestOptions]
|
@@ -115,39 +116,18 @@ module Ittybit
|
|
115
116
|
Ittybit::AutomationResponse.from_json(json_object: response.body)
|
116
117
|
end
|
117
118
|
|
118
|
-
# Updates an existing automation by its ID
|
119
|
-
#
|
120
119
|
# @param id [String]
|
121
|
-
# @param name [String]
|
122
|
-
# @param description [String]
|
123
|
-
# @param trigger [Hash] Defines the trigger event and conditions. To clear/remove a trigger, provide
|
124
|
-
# null. To update, provide the new trigger object.Request of type Ittybit::Automations::AutomationsUpdateRequestTrigger, as a Hash
|
125
|
-
# * :event (String)
|
126
|
-
# * :conditions (Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>)
|
127
|
-
# @param workflow [Array<Hash>] The updated sequence of tasks for the automation.Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
|
128
|
-
# * :kind (Ittybit::WorkflowTaskStepKind)
|
129
|
-
# * :label (String)
|
130
|
-
# * :format (String)
|
131
|
-
# * :width (Integer)
|
132
|
-
# * :height (Integer)
|
133
|
-
# * :resize (String)
|
134
|
-
# * :quality (Integer)
|
135
120
|
# @param request_options [Ittybit::RequestOptions]
|
136
|
-
# @return [
|
121
|
+
# @return [Void]
|
137
122
|
# @example
|
138
123
|
# api = Ittybit::Client.new(
|
139
124
|
# base_url: "https://api.example.com",
|
140
125
|
# environment: Ittybit::Environment::DEFAULT,
|
141
126
|
# token: "YOUR_AUTH_TOKEN"
|
142
127
|
# )
|
143
|
-
# api.automations.update(
|
144
|
-
|
145
|
-
|
146
|
-
# trigger: { event: "upload.completed", conditions: [{ prop: "file.type", value: "image/*" }] },
|
147
|
-
# workflow: [{ kind: IMAGE, label: "archive_image", format: "webp" }]
|
148
|
-
# )
|
149
|
-
def update(id:, name:, description: nil, trigger: nil, workflow: nil, request_options: nil)
|
150
|
-
response = @request_client.conn.put do |req|
|
128
|
+
# api.automations.update(id: "id")
|
129
|
+
def update(id:, request_options: nil)
|
130
|
+
@request_client.conn.put do |req|
|
151
131
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
152
132
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
153
133
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
@@ -159,23 +139,18 @@ module Ittybit
|
|
159
139
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
160
140
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
161
141
|
end
|
162
|
-
|
163
|
-
**(request_options&.additional_body_parameters || {})
|
164
|
-
|
165
|
-
description: description,
|
166
|
-
trigger: trigger,
|
167
|
-
workflow: workflow
|
168
|
-
}.compact
|
142
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
143
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
144
|
+
end
|
169
145
|
req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
|
170
146
|
end
|
171
|
-
Ittybit::AutomationResponse.from_json(json_object: response.body)
|
172
147
|
end
|
173
148
|
|
174
|
-
#
|
149
|
+
# Permanently removes an automation from the system. This action cannot be undone.
|
175
150
|
#
|
176
151
|
# @param id [String]
|
177
152
|
# @param request_options [Ittybit::RequestOptions]
|
178
|
-
# @return [
|
153
|
+
# @return [Ittybit::ConfirmationResponse]
|
179
154
|
# @example
|
180
155
|
# api = Ittybit::Client.new(
|
181
156
|
# base_url: "https://api.example.com",
|
@@ -184,7 +159,7 @@ module Ittybit
|
|
184
159
|
# )
|
185
160
|
# api.automations.delete(id: "id")
|
186
161
|
def delete(id:, request_options: nil)
|
187
|
-
@request_client.conn.delete do |req|
|
162
|
+
response = @request_client.conn.delete do |req|
|
188
163
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
189
164
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
190
165
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
@@ -201,6 +176,62 @@ module Ittybit
|
|
201
176
|
end
|
202
177
|
req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
|
203
178
|
end
|
179
|
+
Ittybit::ConfirmationResponse.from_json(json_object: response.body)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Updates an automation's `name`, `description`, `trigger`, `workflow`, or
|
183
|
+
# `status`. Only the specified fields will be updated.
|
184
|
+
#
|
185
|
+
# @param id [String]
|
186
|
+
# @param name [String]
|
187
|
+
# @param description [String]
|
188
|
+
# @param trigger [Hash] Request of type Ittybit::Automations::UpdateAutomationRequestTrigger, as a Hash
|
189
|
+
# * :kind (String)
|
190
|
+
# * :event (String)
|
191
|
+
# @param workflow [Array<Hash>] Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
|
192
|
+
# * :kind (Ittybit::WorkflowTaskStepKind)
|
193
|
+
# * :ref (String)
|
194
|
+
# * :next_ (Array<Ittybit::WorkflowTaskStepNextItem>)
|
195
|
+
# @param status [Ittybit::Automations::UpdateAutomationRequestStatus]
|
196
|
+
# @param request_options [Ittybit::RequestOptions]
|
197
|
+
# @return [Ittybit::AutomationResponse]
|
198
|
+
# @example
|
199
|
+
# api = Ittybit::Client.new(
|
200
|
+
# base_url: "https://api.example.com",
|
201
|
+
# environment: Ittybit::Environment::DEFAULT,
|
202
|
+
# token: "YOUR_AUTH_TOKEN"
|
203
|
+
# )
|
204
|
+
# api.automations.update_automation(
|
205
|
+
# id: "auto_abcdefgh1234",
|
206
|
+
# name: "My Updated Automation",
|
207
|
+
# workflow: [{ kind: NSFW }, { kind: DESCRIPTION }, { kind: IMAGE, ref: "big_thumbnail" }, { kind: CONDITIONS, next_: [{ kind: "subtitle", ref: "subtitle" }] }],
|
208
|
+
# status: ACTIVE
|
209
|
+
# )
|
210
|
+
def update_automation(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil,
|
211
|
+
request_options: nil)
|
212
|
+
response = @request_client.conn.patch do |req|
|
213
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
214
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
215
|
+
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
216
|
+
req.headers = {
|
217
|
+
**(req.headers || {}),
|
218
|
+
**@request_client.get_headers,
|
219
|
+
**(request_options&.additional_headers || {})
|
220
|
+
}.compact
|
221
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
222
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
223
|
+
end
|
224
|
+
req.body = {
|
225
|
+
**(request_options&.additional_body_parameters || {}),
|
226
|
+
name: name,
|
227
|
+
description: description,
|
228
|
+
trigger: trigger,
|
229
|
+
workflow: workflow,
|
230
|
+
status: status
|
231
|
+
}.compact
|
232
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
|
233
|
+
end
|
234
|
+
Ittybit::AutomationResponse.from_json(json_object: response.body)
|
204
235
|
end
|
205
236
|
end
|
206
237
|
|
@@ -214,8 +245,9 @@ module Ittybit
|
|
214
245
|
@request_client = request_client
|
215
246
|
end
|
216
247
|
|
217
|
-
# Retrieves a list of all automations for the current project
|
248
|
+
# Retrieves a paginated list of all automations for the current project
|
218
249
|
#
|
250
|
+
# @param limit [Integer]
|
219
251
|
# @param request_options [Ittybit::RequestOptions]
|
220
252
|
# @return [Ittybit::AutomationListResponse]
|
221
253
|
# @example
|
@@ -225,7 +257,7 @@ module Ittybit
|
|
225
257
|
# token: "YOUR_AUTH_TOKEN"
|
226
258
|
# )
|
227
259
|
# api.automations.list
|
228
|
-
def list(request_options: nil)
|
260
|
+
def list(limit: nil, request_options: nil)
|
229
261
|
Async do
|
230
262
|
response = @request_client.conn.get do |req|
|
231
263
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -236,9 +268,7 @@ module Ittybit
|
|
236
268
|
**@request_client.get_headers,
|
237
269
|
**(request_options&.additional_headers || {})
|
238
270
|
}.compact
|
239
|
-
|
240
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
241
|
-
end
|
271
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit }.compact
|
242
272
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
243
273
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
244
274
|
end
|
@@ -248,7 +278,7 @@ module Ittybit
|
|
248
278
|
end
|
249
279
|
end
|
250
280
|
|
251
|
-
# Creates a new automation
|
281
|
+
# Creates a new automation.
|
252
282
|
#
|
253
283
|
# @param request_options [Ittybit::RequestOptions]
|
254
284
|
# @return [Ittybit::AutomationResponse]
|
@@ -282,7 +312,7 @@ module Ittybit
|
|
282
312
|
end
|
283
313
|
end
|
284
314
|
|
285
|
-
#
|
315
|
+
# Retrieve the automation object for a automation with the given ID.
|
286
316
|
#
|
287
317
|
# @param id [String]
|
288
318
|
# @param request_options [Ittybit::RequestOptions]
|
@@ -317,40 +347,19 @@ module Ittybit
|
|
317
347
|
end
|
318
348
|
end
|
319
349
|
|
320
|
-
# Updates an existing automation by its ID
|
321
|
-
#
|
322
350
|
# @param id [String]
|
323
|
-
# @param name [String]
|
324
|
-
# @param description [String]
|
325
|
-
# @param trigger [Hash] Defines the trigger event and conditions. To clear/remove a trigger, provide
|
326
|
-
# null. To update, provide the new trigger object.Request of type Ittybit::Automations::AutomationsUpdateRequestTrigger, as a Hash
|
327
|
-
# * :event (String)
|
328
|
-
# * :conditions (Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>)
|
329
|
-
# @param workflow [Array<Hash>] The updated sequence of tasks for the automation.Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
|
330
|
-
# * :kind (Ittybit::WorkflowTaskStepKind)
|
331
|
-
# * :label (String)
|
332
|
-
# * :format (String)
|
333
|
-
# * :width (Integer)
|
334
|
-
# * :height (Integer)
|
335
|
-
# * :resize (String)
|
336
|
-
# * :quality (Integer)
|
337
351
|
# @param request_options [Ittybit::RequestOptions]
|
338
|
-
# @return [
|
352
|
+
# @return [Void]
|
339
353
|
# @example
|
340
354
|
# api = Ittybit::Client.new(
|
341
355
|
# base_url: "https://api.example.com",
|
342
356
|
# environment: Ittybit::Environment::DEFAULT,
|
343
357
|
# token: "YOUR_AUTH_TOKEN"
|
344
358
|
# )
|
345
|
-
# api.automations.update(
|
346
|
-
|
347
|
-
# name: "Updated Transcoder Example",
|
348
|
-
# trigger: { event: "upload.completed", conditions: [{ prop: "file.type", value: "image/*" }] },
|
349
|
-
# workflow: [{ kind: IMAGE, label: "archive_image", format: "webp" }]
|
350
|
-
# )
|
351
|
-
def update(id:, name:, description: nil, trigger: nil, workflow: nil, request_options: nil)
|
359
|
+
# api.automations.update(id: "id")
|
360
|
+
def update(id:, request_options: nil)
|
352
361
|
Async do
|
353
|
-
|
362
|
+
@request_client.conn.put do |req|
|
354
363
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
355
364
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
356
365
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
@@ -362,24 +371,19 @@ module Ittybit
|
|
362
371
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
363
372
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
364
373
|
end
|
365
|
-
|
366
|
-
**(request_options&.additional_body_parameters || {})
|
367
|
-
|
368
|
-
description: description,
|
369
|
-
trigger: trigger,
|
370
|
-
workflow: workflow
|
371
|
-
}.compact
|
374
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
375
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
376
|
+
end
|
372
377
|
req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
|
373
378
|
end
|
374
|
-
Ittybit::AutomationResponse.from_json(json_object: response.body)
|
375
379
|
end
|
376
380
|
end
|
377
381
|
|
378
|
-
#
|
382
|
+
# Permanently removes an automation from the system. This action cannot be undone.
|
379
383
|
#
|
380
384
|
# @param id [String]
|
381
385
|
# @param request_options [Ittybit::RequestOptions]
|
382
|
-
# @return [
|
386
|
+
# @return [Ittybit::ConfirmationResponse]
|
383
387
|
# @example
|
384
388
|
# api = Ittybit::Client.new(
|
385
389
|
# base_url: "https://api.example.com",
|
@@ -389,7 +393,7 @@ module Ittybit
|
|
389
393
|
# api.automations.delete(id: "id")
|
390
394
|
def delete(id:, request_options: nil)
|
391
395
|
Async do
|
392
|
-
@request_client.conn.delete do |req|
|
396
|
+
response = @request_client.conn.delete do |req|
|
393
397
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
394
398
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
395
399
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
@@ -406,6 +410,64 @@ module Ittybit
|
|
406
410
|
end
|
407
411
|
req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
|
408
412
|
end
|
413
|
+
Ittybit::ConfirmationResponse.from_json(json_object: response.body)
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
# Updates an automation's `name`, `description`, `trigger`, `workflow`, or
|
418
|
+
# `status`. Only the specified fields will be updated.
|
419
|
+
#
|
420
|
+
# @param id [String]
|
421
|
+
# @param name [String]
|
422
|
+
# @param description [String]
|
423
|
+
# @param trigger [Hash] Request of type Ittybit::Automations::UpdateAutomationRequestTrigger, as a Hash
|
424
|
+
# * :kind (String)
|
425
|
+
# * :event (String)
|
426
|
+
# @param workflow [Array<Hash>] Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
|
427
|
+
# * :kind (Ittybit::WorkflowTaskStepKind)
|
428
|
+
# * :ref (String)
|
429
|
+
# * :next_ (Array<Ittybit::WorkflowTaskStepNextItem>)
|
430
|
+
# @param status [Ittybit::Automations::UpdateAutomationRequestStatus]
|
431
|
+
# @param request_options [Ittybit::RequestOptions]
|
432
|
+
# @return [Ittybit::AutomationResponse]
|
433
|
+
# @example
|
434
|
+
# api = Ittybit::Client.new(
|
435
|
+
# base_url: "https://api.example.com",
|
436
|
+
# environment: Ittybit::Environment::DEFAULT,
|
437
|
+
# token: "YOUR_AUTH_TOKEN"
|
438
|
+
# )
|
439
|
+
# api.automations.update_automation(
|
440
|
+
# id: "auto_abcdefgh1234",
|
441
|
+
# name: "My Updated Automation",
|
442
|
+
# workflow: [{ kind: NSFW }, { kind: DESCRIPTION }, { kind: IMAGE, ref: "big_thumbnail" }, { kind: CONDITIONS, next_: [{ kind: "subtitle", ref: "subtitle" }] }],
|
443
|
+
# status: ACTIVE
|
444
|
+
# )
|
445
|
+
def update_automation(id:, name: nil, description: nil, trigger: nil, workflow: nil, status: nil,
|
446
|
+
request_options: nil)
|
447
|
+
Async do
|
448
|
+
response = @request_client.conn.patch do |req|
|
449
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
450
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
451
|
+
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
452
|
+
req.headers = {
|
453
|
+
**(req.headers || {}),
|
454
|
+
**@request_client.get_headers,
|
455
|
+
**(request_options&.additional_headers || {})
|
456
|
+
}.compact
|
457
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
458
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
459
|
+
end
|
460
|
+
req.body = {
|
461
|
+
**(request_options&.additional_body_parameters || {}),
|
462
|
+
name: name,
|
463
|
+
description: description,
|
464
|
+
trigger: trigger,
|
465
|
+
workflow: workflow,
|
466
|
+
status: status
|
467
|
+
}.compact
|
468
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/automations/#{id}"
|
469
|
+
end
|
470
|
+
Ittybit::AutomationResponse.from_json(json_object: response.body)
|
409
471
|
end
|
410
472
|
end
|
411
473
|
end
|
@@ -5,11 +5,11 @@ require "json"
|
|
5
5
|
|
6
6
|
module Ittybit
|
7
7
|
class Automations
|
8
|
-
class
|
8
|
+
class UpdateAutomationRequestTrigger
|
9
9
|
# @return [String]
|
10
|
-
attr_reader :
|
10
|
+
attr_reader :kind
|
11
11
|
# @return [String]
|
12
|
-
attr_reader :
|
12
|
+
attr_reader :event
|
13
13
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
14
14
|
attr_reader :additional_properties
|
15
15
|
# @return [Object]
|
@@ -18,36 +18,34 @@ module Ittybit
|
|
18
18
|
|
19
19
|
OMIT = Object.new
|
20
20
|
|
21
|
-
# @param
|
22
|
-
# @param
|
21
|
+
# @param kind [String]
|
22
|
+
# @param event [String]
|
23
23
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
-
# @return [Ittybit::Automations::
|
25
|
-
def initialize(
|
26
|
-
@
|
27
|
-
@
|
24
|
+
# @return [Ittybit::Automations::UpdateAutomationRequestTrigger]
|
25
|
+
def initialize(kind:, event:, additional_properties: nil)
|
26
|
+
@kind = kind
|
27
|
+
@event = event
|
28
28
|
@additional_properties = additional_properties
|
29
|
-
@_field_set = { "
|
29
|
+
@_field_set = { "kind": kind, "event": event }
|
30
30
|
end
|
31
31
|
|
32
|
-
# Deserialize a JSON object to an instance of
|
33
|
-
# AutomationsUpdateRequestTriggerConditionsItem
|
32
|
+
# Deserialize a JSON object to an instance of UpdateAutomationRequestTrigger
|
34
33
|
#
|
35
34
|
# @param json_object [String]
|
36
|
-
# @return [Ittybit::Automations::
|
35
|
+
# @return [Ittybit::Automations::UpdateAutomationRequestTrigger]
|
37
36
|
def self.from_json(json_object:)
|
38
37
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
39
38
|
parsed_json = JSON.parse(json_object)
|
40
|
-
|
41
|
-
|
39
|
+
kind = parsed_json["kind"]
|
40
|
+
event = parsed_json["event"]
|
42
41
|
new(
|
43
|
-
|
44
|
-
|
42
|
+
kind: kind,
|
43
|
+
event: event,
|
45
44
|
additional_properties: struct
|
46
45
|
)
|
47
46
|
end
|
48
47
|
|
49
|
-
# Serialize an instance of
|
50
|
-
# object
|
48
|
+
# Serialize an instance of UpdateAutomationRequestTrigger to a JSON object
|
51
49
|
#
|
52
50
|
# @return [String]
|
53
51
|
def to_json(*_args)
|
@@ -61,8 +59,8 @@ module Ittybit
|
|
61
59
|
# @param obj [Object]
|
62
60
|
# @return [Void]
|
63
61
|
def self.validate_raw(obj:)
|
64
|
-
obj.
|
65
|
-
obj.
|
62
|
+
obj.kind.is_a?(String) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
63
|
+
obj.event.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.")
|
66
64
|
end
|
67
65
|
end
|
68
66
|
end
|