ittybit 0.7.6 → 0.8.2
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 +147 -113
- data/lib/ittybit/automations/types/automations_create_request_status.rb +10 -0
- data/lib/ittybit/automations/types/{automations_update_request_trigger_conditions_item.rb → automations_create_request_trigger.rb} +19 -21
- data/lib/ittybit/automations/types/automations_update_request_status.rb +10 -0
- data/lib/ittybit/automations/types/automations_update_request_trigger.rb +13 -21
- data/lib/ittybit/media/client.rb +2 -2
- data/lib/ittybit/tasks/client.rb +45 -132
- data/lib/ittybit/types/automation.rb +3 -3
- data/lib/ittybit/types/automation_status.rb +1 -2
- data/lib/ittybit/types/automation_trigger.rb +4 -6
- data/lib/ittybit/types/task_summary_kind.rb +4 -4
- data/lib/ittybit/types/workflow_task_step.rb +9 -74
- data/lib/ittybit/types/workflow_task_step_kind.rb +3 -5
- data/lib/ittybit/types/workflow_task_step_next_item.rb +67 -0
- data/lib/ittybit.rb +2 -2
- data/lib/requests.rb +8 -8
- data/lib/types_export.rb +4 -4
- metadata +6 -6
- 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/tasks/client.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../../requests"
|
4
|
-
require_relative "types/tasks_list_request_status"
|
5
|
-
require_relative "types/tasks_list_request_kind"
|
6
4
|
require_relative "../types/task_list_response"
|
7
|
-
require_relative "types/tasks_create_request_kind"
|
8
5
|
require_relative "../types/task_response"
|
9
6
|
require "json"
|
10
7
|
require "async"
|
@@ -20,12 +17,7 @@ module Ittybit
|
|
20
17
|
@request_client = request_client
|
21
18
|
end
|
22
19
|
|
23
|
-
#
|
24
|
-
# kind.
|
25
|
-
#
|
26
|
-
# @param limit [Integer] Items per page.
|
27
|
-
# @param status [Ittybit::Tasks::TasksListRequestStatus] Filter by task status.
|
28
|
-
# @param kind [Ittybit::Tasks::TasksListRequestKind] Filter by task kind.
|
20
|
+
# @param limit [Integer]
|
29
21
|
# @param request_options [Ittybit::RequestOptions]
|
30
22
|
# @return [Ittybit::TaskListResponse]
|
31
23
|
# @example
|
@@ -35,7 +27,7 @@ module Ittybit
|
|
35
27
|
# token: "YOUR_AUTH_TOKEN"
|
36
28
|
# )
|
37
29
|
# api.tasks.list
|
38
|
-
def list(limit: nil,
|
30
|
+
def list(limit: nil, request_options: nil)
|
39
31
|
response = @request_client.conn.get do |req|
|
40
32
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
41
33
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
@@ -45,12 +37,7 @@ module Ittybit
|
|
45
37
|
**@request_client.get_headers,
|
46
38
|
**(request_options&.additional_headers || {})
|
47
39
|
}.compact
|
48
|
-
req.params = {
|
49
|
-
**(request_options&.additional_query_parameters || {}),
|
50
|
-
"limit": limit,
|
51
|
-
"status": status,
|
52
|
-
"kind": kind
|
53
|
-
}.compact
|
40
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit }.compact
|
54
41
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
55
42
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
56
43
|
end
|
@@ -59,23 +46,10 @@ module Ittybit
|
|
59
46
|
Ittybit::TaskListResponse.from_json(json_object: response.body)
|
60
47
|
end
|
61
48
|
|
62
|
-
# Creates a new
|
63
|
-
#
|
49
|
+
# Creates a new task item. See [Tasks](/docs/tasks) for detailed coverage of all
|
50
|
+
# available props and values.
|
64
51
|
#
|
65
|
-
# @param
|
66
|
-
# @param url [String] URL of the source file (required for 'ingest' kind unless file_id is used, can
|
67
|
-
# be used for others).
|
68
|
-
# @param input [Hash{String => Object}] Task-specific input parameters depending on the kind of task.
|
69
|
-
# @param file_id [String] ID of an existing file to use as input (alternative to url).
|
70
|
-
# @param workflow [Array<Hash{String => Object}>] An array of task definition objects for a workflow.
|
71
|
-
# @param webhook_url [String] An optional HTTPS URL to send a webhook notification to upon task completion or
|
72
|
-
# failure.
|
73
|
-
# @param filename [String] Desired filename for the output (if applicable).
|
74
|
-
# @param folder [String] Desired output folder (if applicable).
|
75
|
-
# @param format [String] Output format (e.g., for video/image tasks).
|
76
|
-
# @param width [Integer] Output width (for video/image tasks).
|
77
|
-
# @param height [Integer] Output height (for video/image tasks).
|
78
|
-
# @param quality [Integer] Output quality setting (e.g., for video/image tasks, 0-100).
|
52
|
+
# @param request [Object]
|
79
53
|
# @param request_options [Ittybit::RequestOptions]
|
80
54
|
# @return [Ittybit::TaskResponse]
|
81
55
|
# @example
|
@@ -84,13 +58,8 @@ module Ittybit
|
|
84
58
|
# environment: Ittybit::Environment::DEFAULT,
|
85
59
|
# token: "YOUR_AUTH_TOKEN"
|
86
60
|
# )
|
87
|
-
# api.tasks.create(
|
88
|
-
|
89
|
-
# url: "https://example.com/some_video.mov",
|
90
|
-
# input: { "options": {"filename":"custom_name.mov"} }
|
91
|
-
# )
|
92
|
-
def create(kind:, url: nil, input: nil, file_id: nil, workflow: nil, webhook_url: nil, filename: nil, folder: nil,
|
93
|
-
format: nil, width: nil, height: nil, quality: nil, request_options: nil)
|
61
|
+
# api.tasks.create(request: {"file_id":"file_abcdefgh1234","kind":"image","width":320,"format":"png","ref":"thumbnail"})
|
62
|
+
def create(request: nil, request_options: nil)
|
94
63
|
response = @request_client.conn.post do |req|
|
95
64
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
96
65
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
@@ -103,38 +72,25 @@ module Ittybit
|
|
103
72
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
104
73
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
105
74
|
end
|
106
|
-
req.body = {
|
107
|
-
**(request_options&.additional_body_parameters || {}),
|
108
|
-
kind: kind,
|
109
|
-
url: url,
|
110
|
-
input: input,
|
111
|
-
file_id: file_id,
|
112
|
-
workflow: workflow,
|
113
|
-
webhook_url: webhook_url,
|
114
|
-
filename: filename,
|
115
|
-
folder: folder,
|
116
|
-
format: format,
|
117
|
-
width: width,
|
118
|
-
height: height,
|
119
|
-
quality: quality
|
120
|
-
}.compact
|
75
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
121
76
|
req.url "#{@request_client.get_url(request_options: request_options)}/tasks"
|
122
77
|
end
|
123
78
|
Ittybit::TaskResponse.from_json(json_object: response.body)
|
124
79
|
end
|
125
80
|
|
126
|
-
# Retrieves
|
81
|
+
# Retrieves the task object for a task with the given ID.
|
127
82
|
#
|
83
|
+
# @param id [String]
|
128
84
|
# @param request_options [Ittybit::RequestOptions]
|
129
|
-
# @return [
|
85
|
+
# @return [Ittybit::TaskResponse]
|
130
86
|
# @example
|
131
87
|
# api = Ittybit::Client.new(
|
132
88
|
# base_url: "https://api.example.com",
|
133
89
|
# environment: Ittybit::Environment::DEFAULT,
|
134
90
|
# token: "YOUR_AUTH_TOKEN"
|
135
91
|
# )
|
136
|
-
# api.tasks.
|
137
|
-
def
|
92
|
+
# api.tasks.get(id: "id")
|
93
|
+
def get(id:, request_options: nil)
|
138
94
|
response = @request_client.conn.get do |req|
|
139
95
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
140
96
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
@@ -150,24 +106,23 @@ module Ittybit
|
|
150
106
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
151
107
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
152
108
|
end
|
153
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/tasks
|
109
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tasks/#{id}"
|
154
110
|
end
|
155
|
-
|
111
|
+
Ittybit::TaskResponse.from_json(json_object: response.body)
|
156
112
|
end
|
157
113
|
|
158
|
-
# Retrieves
|
114
|
+
# Retrieves available task kinds and their configuration options.
|
159
115
|
#
|
160
|
-
# @param id [String]
|
161
116
|
# @param request_options [Ittybit::RequestOptions]
|
162
|
-
# @return [
|
117
|
+
# @return [Hash{String => Object}]
|
163
118
|
# @example
|
164
119
|
# api = Ittybit::Client.new(
|
165
120
|
# base_url: "https://api.example.com",
|
166
121
|
# environment: Ittybit::Environment::DEFAULT,
|
167
122
|
# token: "YOUR_AUTH_TOKEN"
|
168
123
|
# )
|
169
|
-
# api.tasks.
|
170
|
-
def
|
124
|
+
# api.tasks.get_task_config
|
125
|
+
def get_task_config(request_options: nil)
|
171
126
|
response = @request_client.conn.get do |req|
|
172
127
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
173
128
|
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
@@ -183,9 +138,9 @@ module Ittybit
|
|
183
138
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
184
139
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
185
140
|
end
|
186
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/tasks
|
141
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tasks-config"
|
187
142
|
end
|
188
|
-
|
143
|
+
JSON.parse(response.body)
|
189
144
|
end
|
190
145
|
end
|
191
146
|
|
@@ -199,12 +154,7 @@ module Ittybit
|
|
199
154
|
@request_client = request_client
|
200
155
|
end
|
201
156
|
|
202
|
-
#
|
203
|
-
# kind.
|
204
|
-
#
|
205
|
-
# @param limit [Integer] Items per page.
|
206
|
-
# @param status [Ittybit::Tasks::TasksListRequestStatus] Filter by task status.
|
207
|
-
# @param kind [Ittybit::Tasks::TasksListRequestKind] Filter by task kind.
|
157
|
+
# @param limit [Integer]
|
208
158
|
# @param request_options [Ittybit::RequestOptions]
|
209
159
|
# @return [Ittybit::TaskListResponse]
|
210
160
|
# @example
|
@@ -214,7 +164,7 @@ module Ittybit
|
|
214
164
|
# token: "YOUR_AUTH_TOKEN"
|
215
165
|
# )
|
216
166
|
# api.tasks.list
|
217
|
-
def list(limit: nil,
|
167
|
+
def list(limit: nil, request_options: nil)
|
218
168
|
Async do
|
219
169
|
response = @request_client.conn.get do |req|
|
220
170
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -225,12 +175,7 @@ module Ittybit
|
|
225
175
|
**@request_client.get_headers,
|
226
176
|
**(request_options&.additional_headers || {})
|
227
177
|
}.compact
|
228
|
-
req.params = {
|
229
|
-
**(request_options&.additional_query_parameters || {}),
|
230
|
-
"limit": limit,
|
231
|
-
"status": status,
|
232
|
-
"kind": kind
|
233
|
-
}.compact
|
178
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit }.compact
|
234
179
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
235
180
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
236
181
|
end
|
@@ -240,23 +185,10 @@ module Ittybit
|
|
240
185
|
end
|
241
186
|
end
|
242
187
|
|
243
|
-
# Creates a new
|
244
|
-
#
|
188
|
+
# Creates a new task item. See [Tasks](/docs/tasks) for detailed coverage of all
|
189
|
+
# available props and values.
|
245
190
|
#
|
246
|
-
# @param
|
247
|
-
# @param url [String] URL of the source file (required for 'ingest' kind unless file_id is used, can
|
248
|
-
# be used for others).
|
249
|
-
# @param input [Hash{String => Object}] Task-specific input parameters depending on the kind of task.
|
250
|
-
# @param file_id [String] ID of an existing file to use as input (alternative to url).
|
251
|
-
# @param workflow [Array<Hash{String => Object}>] An array of task definition objects for a workflow.
|
252
|
-
# @param webhook_url [String] An optional HTTPS URL to send a webhook notification to upon task completion or
|
253
|
-
# failure.
|
254
|
-
# @param filename [String] Desired filename for the output (if applicable).
|
255
|
-
# @param folder [String] Desired output folder (if applicable).
|
256
|
-
# @param format [String] Output format (e.g., for video/image tasks).
|
257
|
-
# @param width [Integer] Output width (for video/image tasks).
|
258
|
-
# @param height [Integer] Output height (for video/image tasks).
|
259
|
-
# @param quality [Integer] Output quality setting (e.g., for video/image tasks, 0-100).
|
191
|
+
# @param request [Object]
|
260
192
|
# @param request_options [Ittybit::RequestOptions]
|
261
193
|
# @return [Ittybit::TaskResponse]
|
262
194
|
# @example
|
@@ -265,13 +197,8 @@ module Ittybit
|
|
265
197
|
# environment: Ittybit::Environment::DEFAULT,
|
266
198
|
# token: "YOUR_AUTH_TOKEN"
|
267
199
|
# )
|
268
|
-
# api.tasks.create(
|
269
|
-
|
270
|
-
# url: "https://example.com/some_video.mov",
|
271
|
-
# input: { "options": {"filename":"custom_name.mov"} }
|
272
|
-
# )
|
273
|
-
def create(kind:, url: nil, input: nil, file_id: nil, workflow: nil, webhook_url: nil, filename: nil, folder: nil,
|
274
|
-
format: nil, width: nil, height: nil, quality: nil, request_options: nil)
|
200
|
+
# api.tasks.create(request: {"file_id":"file_abcdefgh1234","kind":"image","width":320,"format":"png","ref":"thumbnail"})
|
201
|
+
def create(request: nil, request_options: nil)
|
275
202
|
Async do
|
276
203
|
response = @request_client.conn.post do |req|
|
277
204
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -285,39 +212,26 @@ module Ittybit
|
|
285
212
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
286
213
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
287
214
|
end
|
288
|
-
req.body = {
|
289
|
-
**(request_options&.additional_body_parameters || {}),
|
290
|
-
kind: kind,
|
291
|
-
url: url,
|
292
|
-
input: input,
|
293
|
-
file_id: file_id,
|
294
|
-
workflow: workflow,
|
295
|
-
webhook_url: webhook_url,
|
296
|
-
filename: filename,
|
297
|
-
folder: folder,
|
298
|
-
format: format,
|
299
|
-
width: width,
|
300
|
-
height: height,
|
301
|
-
quality: quality
|
302
|
-
}.compact
|
215
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
303
216
|
req.url "#{@request_client.get_url(request_options: request_options)}/tasks"
|
304
217
|
end
|
305
218
|
Ittybit::TaskResponse.from_json(json_object: response.body)
|
306
219
|
end
|
307
220
|
end
|
308
221
|
|
309
|
-
# Retrieves
|
222
|
+
# Retrieves the task object for a task with the given ID.
|
310
223
|
#
|
224
|
+
# @param id [String]
|
311
225
|
# @param request_options [Ittybit::RequestOptions]
|
312
|
-
# @return [
|
226
|
+
# @return [Ittybit::TaskResponse]
|
313
227
|
# @example
|
314
228
|
# api = Ittybit::Client.new(
|
315
229
|
# base_url: "https://api.example.com",
|
316
230
|
# environment: Ittybit::Environment::DEFAULT,
|
317
231
|
# token: "YOUR_AUTH_TOKEN"
|
318
232
|
# )
|
319
|
-
# api.tasks.
|
320
|
-
def
|
233
|
+
# api.tasks.get(id: "id")
|
234
|
+
def get(id:, request_options: nil)
|
321
235
|
Async do
|
322
236
|
response = @request_client.conn.get do |req|
|
323
237
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -334,26 +248,24 @@ module Ittybit
|
|
334
248
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
335
249
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
336
250
|
end
|
337
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/tasks
|
251
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tasks/#{id}"
|
338
252
|
end
|
339
|
-
|
340
|
-
parsed_json
|
253
|
+
Ittybit::TaskResponse.from_json(json_object: response.body)
|
341
254
|
end
|
342
255
|
end
|
343
256
|
|
344
|
-
# Retrieves
|
257
|
+
# Retrieves available task kinds and their configuration options.
|
345
258
|
#
|
346
|
-
# @param id [String]
|
347
259
|
# @param request_options [Ittybit::RequestOptions]
|
348
|
-
# @return [
|
260
|
+
# @return [Hash{String => Object}]
|
349
261
|
# @example
|
350
262
|
# api = Ittybit::Client.new(
|
351
263
|
# base_url: "https://api.example.com",
|
352
264
|
# environment: Ittybit::Environment::DEFAULT,
|
353
265
|
# token: "YOUR_AUTH_TOKEN"
|
354
266
|
# )
|
355
|
-
# api.tasks.
|
356
|
-
def
|
267
|
+
# api.tasks.get_task_config
|
268
|
+
def get_task_config(request_options: nil)
|
357
269
|
Async do
|
358
270
|
response = @request_client.conn.get do |req|
|
359
271
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -370,9 +282,10 @@ module Ittybit
|
|
370
282
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
371
283
|
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
372
284
|
end
|
373
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/tasks
|
285
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tasks-config"
|
374
286
|
end
|
375
|
-
|
287
|
+
parsed_json = JSON.parse(response.body)
|
288
|
+
parsed_json
|
376
289
|
end
|
377
290
|
end
|
378
291
|
end
|
@@ -43,10 +43,10 @@ module Ittybit
|
|
43
43
|
# @param updated [DateTime]
|
44
44
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
45
45
|
# @return [Ittybit::Automation]
|
46
|
-
def initialize(id:,
|
46
|
+
def initialize(id:, trigger:, workflow:, status:, created:, updated:, name: OMIT, description: OMIT,
|
47
47
|
additional_properties: nil)
|
48
48
|
@id = id
|
49
|
-
@name = name
|
49
|
+
@name = name if name != OMIT
|
50
50
|
@description = description if description != OMIT
|
51
51
|
@trigger = trigger
|
52
52
|
@workflow = workflow
|
@@ -119,7 +119,7 @@ module Ittybit
|
|
119
119
|
# @return [Void]
|
120
120
|
def self.validate_raw(obj:)
|
121
121
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
122
|
-
obj.name
|
122
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
123
123
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
124
124
|
Ittybit::AutomationTrigger.validate_raw(obj: obj.trigger)
|
125
125
|
obj.workflow.is_a?(Array) != false || raise("Passed value for field obj.workflow is not the expected type, validation failed.")
|
@@ -21,13 +21,11 @@ module Ittybit
|
|
21
21
|
# @param event [String]
|
22
22
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
23
23
|
# @return [Ittybit::AutomationTrigger]
|
24
|
-
def initialize(event:,
|
25
|
-
@kind = kind
|
24
|
+
def initialize(kind:, event:, additional_properties: nil)
|
25
|
+
@kind = kind
|
26
26
|
@event = event
|
27
27
|
@additional_properties = additional_properties
|
28
|
-
@_field_set = { "kind": kind, "event": event }
|
29
|
-
v == OMIT
|
30
|
-
end
|
28
|
+
@_field_set = { "kind": kind, "event": event }
|
31
29
|
end
|
32
30
|
|
33
31
|
# Deserialize a JSON object to an instance of AutomationTrigger
|
@@ -60,7 +58,7 @@ module Ittybit
|
|
60
58
|
# @param obj [Object]
|
61
59
|
# @return [Void]
|
62
60
|
def self.validate_raw(obj:)
|
63
|
-
obj.kind
|
61
|
+
obj.kind.is_a?(String) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
64
62
|
obj.event.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.")
|
65
63
|
end
|
66
64
|
end
|
@@ -2,20 +2,20 @@
|
|
2
2
|
|
3
3
|
module Ittybit
|
4
4
|
class TaskSummaryKind
|
5
|
+
INGEST = "ingest"
|
5
6
|
VIDEO = "video"
|
6
7
|
IMAGE = "image"
|
7
8
|
AUDIO = "audio"
|
8
9
|
CHAPTERS = "chapters"
|
9
10
|
SUBTITLES = "subtitles"
|
10
11
|
THUMBNAILS = "thumbnails"
|
12
|
+
NSFW = "nsfw"
|
11
13
|
SPEECH = "speech"
|
12
14
|
DESCRIPTION = "description"
|
13
|
-
NSFW = "nsfw"
|
14
|
-
PROMPT = "prompt"
|
15
15
|
OUTLINE = "outline"
|
16
|
-
|
17
|
-
INGEST = "ingest"
|
16
|
+
PROMPT = "prompt"
|
18
17
|
WORKFLOW = "workflow"
|
19
18
|
CONDITIONS = "conditions"
|
19
|
+
HTTP = "http"
|
20
20
|
end
|
21
21
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "workflow_task_step_kind"
|
4
|
+
require_relative "workflow_task_step_next_item"
|
4
5
|
require "ostruct"
|
5
6
|
require "json"
|
6
7
|
|
@@ -10,23 +11,7 @@ module Ittybit
|
|
10
11
|
attr_reader :kind
|
11
12
|
# @return [String]
|
12
13
|
attr_reader :ref
|
13
|
-
# @return [
|
14
|
-
attr_reader :format
|
15
|
-
# @return [Float]
|
16
|
-
attr_reader :start
|
17
|
-
# @return [Float]
|
18
|
-
attr_reader :end_
|
19
|
-
# @return [Integer]
|
20
|
-
attr_reader :width
|
21
|
-
# @return [Integer]
|
22
|
-
attr_reader :height
|
23
|
-
# @return [String]
|
24
|
-
attr_reader :fit
|
25
|
-
# @return [String]
|
26
|
-
attr_reader :background
|
27
|
-
# @return [Integer]
|
28
|
-
attr_reader :quality
|
29
|
-
# @return [Array<Object>]
|
14
|
+
# @return [Array<Ittybit::WorkflowTaskStepNextItem>]
|
30
15
|
attr_reader :next_
|
31
16
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
32
17
|
attr_reader :additional_properties
|
@@ -38,44 +23,15 @@ module Ittybit
|
|
38
23
|
|
39
24
|
# @param kind [Ittybit::WorkflowTaskStepKind]
|
40
25
|
# @param ref [String]
|
41
|
-
# @param
|
42
|
-
# @param start [Float]
|
43
|
-
# @param end_ [Float]
|
44
|
-
# @param width [Integer]
|
45
|
-
# @param height [Integer]
|
46
|
-
# @param fit [String]
|
47
|
-
# @param background [String]
|
48
|
-
# @param quality [Integer]
|
49
|
-
# @param next_ [Array<Object>]
|
26
|
+
# @param next_ [Array<Ittybit::WorkflowTaskStepNextItem>]
|
50
27
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
51
28
|
# @return [Ittybit::WorkflowTaskStep]
|
52
|
-
def initialize(kind:, ref: OMIT,
|
53
|
-
background: OMIT, quality: OMIT, next_: OMIT, additional_properties: nil)
|
29
|
+
def initialize(kind:, ref: OMIT, next_: OMIT, additional_properties: nil)
|
54
30
|
@kind = kind
|
55
31
|
@ref = ref if ref != OMIT
|
56
|
-
@format = format if format != OMIT
|
57
|
-
@start = start if start != OMIT
|
58
|
-
@end_ = end_ if end_ != OMIT
|
59
|
-
@width = width if width != OMIT
|
60
|
-
@height = height if height != OMIT
|
61
|
-
@fit = fit if fit != OMIT
|
62
|
-
@background = background if background != OMIT
|
63
|
-
@quality = quality if quality != OMIT
|
64
32
|
@next_ = next_ if next_ != OMIT
|
65
33
|
@additional_properties = additional_properties
|
66
|
-
@_field_set = {
|
67
|
-
"kind": kind,
|
68
|
-
"ref": ref,
|
69
|
-
"format": format,
|
70
|
-
"start": start,
|
71
|
-
"end": end_,
|
72
|
-
"width": width,
|
73
|
-
"height": height,
|
74
|
-
"fit": fit,
|
75
|
-
"background": background,
|
76
|
-
"quality": quality,
|
77
|
-
"next": next_
|
78
|
-
}.reject do |_k, v|
|
34
|
+
@_field_set = { "kind": kind, "ref": ref, "next": next_ }.reject do |_k, v|
|
79
35
|
v == OMIT
|
80
36
|
end
|
81
37
|
end
|
@@ -89,26 +45,13 @@ module Ittybit
|
|
89
45
|
parsed_json = JSON.parse(json_object)
|
90
46
|
kind = parsed_json["kind"]
|
91
47
|
ref = parsed_json["ref"]
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
height = parsed_json["height"]
|
97
|
-
fit = parsed_json["fit"]
|
98
|
-
background = parsed_json["background"]
|
99
|
-
quality = parsed_json["quality"]
|
100
|
-
next_ = parsed_json["next"]
|
48
|
+
next_ = parsed_json["next"]&.map do |item|
|
49
|
+
item = item.to_json
|
50
|
+
Ittybit::WorkflowTaskStepNextItem.from_json(json_object: item)
|
51
|
+
end
|
101
52
|
new(
|
102
53
|
kind: kind,
|
103
54
|
ref: ref,
|
104
|
-
format: format,
|
105
|
-
start: start,
|
106
|
-
end_: end_,
|
107
|
-
width: width,
|
108
|
-
height: height,
|
109
|
-
fit: fit,
|
110
|
-
background: background,
|
111
|
-
quality: quality,
|
112
55
|
next_: next_,
|
113
56
|
additional_properties: struct
|
114
57
|
)
|
@@ -130,14 +73,6 @@ module Ittybit
|
|
130
73
|
def self.validate_raw(obj:)
|
131
74
|
obj.kind.is_a?(Ittybit::WorkflowTaskStepKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
132
75
|
obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.")
|
133
|
-
obj.format&.is_a?(String) != false || raise("Passed value for field obj.format is not the expected type, validation failed.")
|
134
|
-
obj.start&.is_a?(Float) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
135
|
-
obj.end_&.is_a?(Float) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
136
|
-
obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.")
|
137
|
-
obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.")
|
138
|
-
obj.fit&.is_a?(String) != false || raise("Passed value for field obj.fit is not the expected type, validation failed.")
|
139
|
-
obj.background&.is_a?(String) != false || raise("Passed value for field obj.background is not the expected type, validation failed.")
|
140
|
-
obj.quality&.is_a?(Integer) != false || raise("Passed value for field obj.quality is not the expected type, validation failed.")
|
141
76
|
obj.next_&.is_a?(Array) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
|
142
77
|
end
|
143
78
|
end
|
@@ -8,14 +8,12 @@ module Ittybit
|
|
8
8
|
CHAPTERS = "chapters"
|
9
9
|
SUBTITLES = "subtitles"
|
10
10
|
THUMBNAILS = "thumbnails"
|
11
|
+
NSFW = "nsfw"
|
11
12
|
SPEECH = "speech"
|
12
13
|
DESCRIPTION = "description"
|
13
|
-
NSFW = "nsfw"
|
14
|
-
PROMPT = "prompt"
|
15
14
|
OUTLINE = "outline"
|
16
|
-
|
17
|
-
INGEST = "ingest"
|
18
|
-
WORKFLOW = "workflow"
|
15
|
+
PROMPT = "prompt"
|
19
16
|
CONDITIONS = "conditions"
|
17
|
+
HTTP = "http"
|
20
18
|
end
|
21
19
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
class WorkflowTaskStepNextItem
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :kind
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :ref
|
12
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
attr_reader :additional_properties
|
14
|
+
# @return [Object]
|
15
|
+
attr_reader :_field_set
|
16
|
+
protected :_field_set
|
17
|
+
|
18
|
+
OMIT = Object.new
|
19
|
+
|
20
|
+
# @param kind [String]
|
21
|
+
# @param ref [String]
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
# @return [Ittybit::WorkflowTaskStepNextItem]
|
24
|
+
def initialize(kind: OMIT, ref: OMIT, additional_properties: nil)
|
25
|
+
@kind = kind if kind != OMIT
|
26
|
+
@ref = ref if ref != OMIT
|
27
|
+
@additional_properties = additional_properties
|
28
|
+
@_field_set = { "kind": kind, "ref": ref }.reject do |_k, v|
|
29
|
+
v == OMIT
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Deserialize a JSON object to an instance of WorkflowTaskStepNextItem
|
34
|
+
#
|
35
|
+
# @param json_object [String]
|
36
|
+
# @return [Ittybit::WorkflowTaskStepNextItem]
|
37
|
+
def self.from_json(json_object:)
|
38
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
39
|
+
parsed_json = JSON.parse(json_object)
|
40
|
+
kind = parsed_json["kind"]
|
41
|
+
ref = parsed_json["ref"]
|
42
|
+
new(
|
43
|
+
kind: kind,
|
44
|
+
ref: ref,
|
45
|
+
additional_properties: struct
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Serialize an instance of WorkflowTaskStepNextItem to a JSON object
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
def to_json(*_args)
|
53
|
+
@_field_set&.to_json
|
54
|
+
end
|
55
|
+
|
56
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
57
|
+
# hash and check each fields type against the current object's property
|
58
|
+
# definitions.
|
59
|
+
#
|
60
|
+
# @param obj [Object]
|
61
|
+
# @return [Void]
|
62
|
+
def self.validate_raw(obj:)
|
63
|
+
obj.kind&.is_a?(String) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
64
|
+
obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/ittybit.rb
CHANGED
@@ -27,7 +27,7 @@ module Ittybit
|
|
27
27
|
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
28
28
|
# @param timeout_in_seconds [Long]
|
29
29
|
# @param token [String]
|
30
|
-
# @param version [
|
30
|
+
# @param version [Integer]
|
31
31
|
# @return [Ittybit::Client]
|
32
32
|
def initialize(token:, base_url: nil, environment: Ittybit::Environment::DEFAULT, max_retries: nil,
|
33
33
|
timeout_in_seconds: nil, version: nil)
|
@@ -64,7 +64,7 @@ module Ittybit
|
|
64
64
|
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
65
65
|
# @param timeout_in_seconds [Long]
|
66
66
|
# @param token [String]
|
67
|
-
# @param version [
|
67
|
+
# @param version [Integer]
|
68
68
|
# @return [Ittybit::AsyncClient]
|
69
69
|
def initialize(token:, base_url: nil, environment: Ittybit::Environment::DEFAULT, max_retries: nil,
|
70
70
|
timeout_in_seconds: nil, version: nil)
|