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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ittybit/automations/client.rb +149 -87
  3. data/lib/ittybit/automations/types/update_automation_request_status.rb +10 -0
  4. data/lib/ittybit/automations/types/{automations_update_request_trigger_conditions_item.rb → update_automation_request_trigger.rb} +19 -21
  5. data/lib/ittybit/files/client.rb +67 -77
  6. data/lib/ittybit/media/client.rb +78 -34
  7. data/lib/ittybit/signatures/client.rb +20 -24
  8. data/lib/ittybit/signatures/types/signatures_create_request_method.rb +0 -3
  9. data/lib/ittybit/tasks/client.rb +45 -132
  10. data/lib/ittybit/types/automation.rb +19 -29
  11. data/lib/ittybit/types/automation_list_response.rb +15 -2
  12. data/lib/ittybit/types/automation_response.rb +15 -2
  13. data/lib/ittybit/types/automation_status.rb +1 -3
  14. data/lib/ittybit/types/automation_trigger.rb +11 -18
  15. data/lib/ittybit/types/{confirmation_response_data.rb → confirmation.rb} +11 -9
  16. data/lib/ittybit/types/confirmation_response.rb +20 -7
  17. data/lib/ittybit/types/file.rb +64 -68
  18. data/lib/ittybit/types/file_kind.rb +0 -1
  19. data/lib/ittybit/types/file_list_response.rb +15 -2
  20. data/lib/ittybit/types/file_object.rb +0 -1
  21. data/lib/ittybit/types/file_response.rb +15 -2
  22. data/lib/ittybit/types/file_status.rb +0 -1
  23. data/lib/ittybit/types/links.rb +4 -4
  24. data/lib/ittybit/types/links_list.rb +17 -32
  25. data/lib/ittybit/types/media.rb +34 -56
  26. data/lib/ittybit/types/media_kind.rb +0 -1
  27. data/lib/ittybit/types/media_list_response.rb +15 -2
  28. data/lib/ittybit/types/media_response.rb +15 -2
  29. data/lib/ittybit/types/media_source.rb +52 -53
  30. data/lib/ittybit/types/media_source_kind.rb +0 -1
  31. data/lib/ittybit/types/media_source_object.rb +0 -1
  32. data/lib/ittybit/types/media_source_orientation.rb +9 -0
  33. data/lib/ittybit/types/media_source_status.rb +0 -1
  34. data/lib/ittybit/types/meta_list.rb +40 -15
  35. data/lib/ittybit/types/meta_list_type.rb +8 -0
  36. data/lib/ittybit/types/signature.rb +14 -14
  37. data/lib/ittybit/types/signature_response.rb +15 -2
  38. data/lib/ittybit/types/task.rb +30 -50
  39. data/lib/ittybit/types/task_list_response.rb +15 -2
  40. data/lib/ittybit/types/task_response.rb +15 -2
  41. data/lib/ittybit/types/task_status.rb +0 -1
  42. data/lib/ittybit/types/task_summary.rb +20 -20
  43. data/lib/ittybit/types/task_summary_kind.rb +9 -13
  44. data/lib/ittybit/types/task_summary_status.rb +0 -1
  45. data/lib/ittybit/types/workflow_task_step.rb +22 -55
  46. data/lib/ittybit/types/workflow_task_step_kind.rb +8 -14
  47. data/lib/ittybit/types/{error_response.rb → workflow_task_step_next_item.rb} +21 -28
  48. data/lib/ittybit.rb +2 -2
  49. data/lib/requests.rb +8 -8
  50. data/lib/types_export.rb +6 -11
  51. metadata +8 -13
  52. data/lib/ittybit/automations/types/automations_update_request_trigger.rb +0 -75
  53. data/lib/ittybit/files/types/files_delete_response.rb +0 -89
  54. data/lib/ittybit/files/types/files_delete_response_data.rb +0 -60
  55. data/lib/ittybit/tasks/types/tasks_create_request_kind.rb +0 -22
  56. data/lib/ittybit/tasks/types/tasks_list_request_kind.rb +0 -26
  57. data/lib/ittybit/tasks/types/tasks_list_request_status.rb +0 -16
  58. data/lib/ittybit/types/automation_trigger_conditions_item.rb +0 -65
  59. data/lib/ittybit/types/media_urls.rb +0 -70
@@ -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
- # Retrieves a list of tasks for the project, optionally filtered by status or
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, status: nil, kind: nil, request_options: 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 processing task (e.g., ingest, video transcode, speech analysis)
63
- # or a workflow task.
49
+ # Creates a new task item. See [Tasks](/docs/tasks) for detailed coverage of all
50
+ # available props and values.
64
51
  #
65
- # @param kind [Ittybit::Tasks::TasksCreateRequestKind] The type of task to create.
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
- # kind: INGEST,
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 available task kinds and their configuration options.
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 [Hash{String => Object}]
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.get_task_config
137
- def get_task_config(request_options: nil)
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-config"
109
+ req.url "#{@request_client.get_url(request_options: request_options)}/tasks/#{id}"
154
110
  end
155
- JSON.parse(response.body)
111
+ Ittybit::TaskResponse.from_json(json_object: response.body)
156
112
  end
157
113
 
158
- # Retrieves the details of a specific task by its ID.
114
+ # Retrieves available task kinds and their configuration options.
159
115
  #
160
- # @param id [String]
161
116
  # @param request_options [Ittybit::RequestOptions]
162
- # @return [Ittybit::TaskResponse]
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.get(id: "id")
170
- def get(id:, request_options: nil)
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/#{id}"
141
+ req.url "#{@request_client.get_url(request_options: request_options)}/tasks-config"
187
142
  end
188
- Ittybit::TaskResponse.from_json(json_object: response.body)
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
- # Retrieves a list of tasks for the project, optionally filtered by status or
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, status: nil, kind: nil, request_options: 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 processing task (e.g., ingest, video transcode, speech analysis)
244
- # or a workflow task.
188
+ # Creates a new task item. See [Tasks](/docs/tasks) for detailed coverage of all
189
+ # available props and values.
245
190
  #
246
- # @param kind [Ittybit::Tasks::TasksCreateRequestKind] The type of task to create.
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
- # kind: INGEST,
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 available task kinds and their configuration options.
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 [Hash{String => Object}]
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.get_task_config
320
- def get_task_config(request_options: nil)
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-config"
251
+ req.url "#{@request_client.get_url(request_options: request_options)}/tasks/#{id}"
338
252
  end
339
- parsed_json = JSON.parse(response.body)
340
- parsed_json
253
+ Ittybit::TaskResponse.from_json(json_object: response.body)
341
254
  end
342
255
  end
343
256
 
344
- # Retrieves the details of a specific task by its ID.
257
+ # Retrieves available task kinds and their configuration options.
345
258
  #
346
- # @param id [String]
347
259
  # @param request_options [Ittybit::RequestOptions]
348
- # @return [Ittybit::TaskResponse]
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.get(id: "id")
356
- def get(id:, request_options: nil)
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/#{id}"
285
+ req.url "#{@request_client.get_url(request_options: request_options)}/tasks-config"
374
286
  end
375
- Ittybit::TaskResponse.from_json(json_object: response.body)
287
+ parsed_json = JSON.parse(response.body)
288
+ parsed_json
376
289
  end
377
290
  end
378
291
  end
@@ -9,24 +9,21 @@ require "json"
9
9
 
10
10
  module Ittybit
11
11
  class Automation
12
- # @return [String] Unique identifier for the automation
12
+ # @return [String]
13
13
  attr_reader :id
14
- # @return [String] User-defined name for the automation
14
+ # @return [String]
15
15
  attr_reader :name
16
- # @return [String] Optional description for the automation
16
+ # @return [String]
17
17
  attr_reader :description
18
- # @return [Hash{String => Object}] User-defined key-value metadata for the automation.
19
- attr_reader :metadata
20
- # @return [Ittybit::AutomationTrigger] The event and conditions that trigger this automation.
18
+ # @return [Ittybit::AutomationTrigger]
21
19
  attr_reader :trigger
22
- # @return [Array<Ittybit::WorkflowTaskStep>] The sequence of tasks to be executed when the automation is triggered. The
23
- # structure of each task object varies depending on its 'kind'.
20
+ # @return [Array<Ittybit::WorkflowTaskStep>]
24
21
  attr_reader :workflow
25
- # @return [Ittybit::AutomationStatus] Current status of the automation
22
+ # @return [Ittybit::AutomationStatus]
26
23
  attr_reader :status
27
- # @return [DateTime] Timestamp when the automation was created
24
+ # @return [DateTime]
28
25
  attr_reader :created
29
- # @return [DateTime] Timestamp when the automation was last updated
26
+ # @return [DateTime]
30
27
  attr_reader :updated
31
28
  # @return [OpenStruct] Additional properties unmapped to the current class definition
32
29
  attr_reader :additional_properties
@@ -36,24 +33,21 @@ module Ittybit
36
33
 
37
34
  OMIT = Object.new
38
35
 
39
- # @param id [String] Unique identifier for the automation
40
- # @param name [String] User-defined name for the automation
41
- # @param description [String] Optional description for the automation
42
- # @param metadata [Hash{String => Object}] User-defined key-value metadata for the automation.
43
- # @param trigger [Ittybit::AutomationTrigger] The event and conditions that trigger this automation.
44
- # @param workflow [Array<Ittybit::WorkflowTaskStep>] The sequence of tasks to be executed when the automation is triggered. The
45
- # structure of each task object varies depending on its 'kind'.
46
- # @param status [Ittybit::AutomationStatus] Current status of the automation
47
- # @param created [DateTime] Timestamp when the automation was created
48
- # @param updated [DateTime] Timestamp when the automation was last updated
36
+ # @param id [String]
37
+ # @param name [String]
38
+ # @param description [String]
39
+ # @param trigger [Ittybit::AutomationTrigger]
40
+ # @param workflow [Array<Ittybit::WorkflowTaskStep>]
41
+ # @param status [Ittybit::AutomationStatus]
42
+ # @param created [DateTime]
43
+ # @param updated [DateTime]
49
44
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
50
45
  # @return [Ittybit::Automation]
51
- def initialize(id:, name:, trigger:, workflow:, status:, created:, updated:, description: OMIT, metadata: OMIT,
46
+ def initialize(id:, trigger:, workflow:, status:, created:, updated:, name: OMIT, description: OMIT,
52
47
  additional_properties: nil)
53
48
  @id = id
54
- @name = name
49
+ @name = name if name != OMIT
55
50
  @description = description if description != OMIT
56
- @metadata = metadata if metadata != OMIT
57
51
  @trigger = trigger
58
52
  @workflow = workflow
59
53
  @status = status
@@ -64,7 +58,6 @@ module Ittybit
64
58
  "id": id,
65
59
  "name": name,
66
60
  "description": description,
67
- "metadata": metadata,
68
61
  "trigger": trigger,
69
62
  "workflow": workflow,
70
63
  "status": status,
@@ -85,7 +78,6 @@ module Ittybit
85
78
  id = parsed_json["id"]
86
79
  name = parsed_json["name"]
87
80
  description = parsed_json["description"]
88
- metadata = parsed_json["metadata"]
89
81
  if parsed_json["trigger"].nil?
90
82
  trigger = nil
91
83
  else
@@ -103,7 +95,6 @@ module Ittybit
103
95
  id: id,
104
96
  name: name,
105
97
  description: description,
106
- metadata: metadata,
107
98
  trigger: trigger,
108
99
  workflow: workflow,
109
100
  status: status,
@@ -128,9 +119,8 @@ module Ittybit
128
119
  # @return [Void]
129
120
  def self.validate_raw(obj:)
130
121
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
131
- obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
122
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
132
123
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
133
- obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
134
124
  Ittybit::AutomationTrigger.validate_raw(obj: obj.trigger)
135
125
  obj.workflow.is_a?(Array) != false || raise("Passed value for field obj.workflow is not the expected type, validation failed.")
136
126
  obj.status.is_a?(Ittybit::AutomationStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "meta_list"
4
4
  require_relative "automation"
5
+ require_relative "error"
5
6
  require_relative "links_list"
6
7
  require "ostruct"
7
8
  require "json"
@@ -12,6 +13,8 @@ module Ittybit
12
13
  attr_reader :meta
13
14
  # @return [Array<Ittybit::Automation>]
14
15
  attr_reader :data
16
+ # @return [Ittybit::Error]
17
+ attr_reader :error
15
18
  # @return [Ittybit::LinksList]
16
19
  attr_reader :links
17
20
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -24,15 +27,17 @@ module Ittybit
24
27
 
25
28
  # @param meta [Ittybit::MetaList]
26
29
  # @param data [Array<Ittybit::Automation>]
30
+ # @param error [Ittybit::Error]
27
31
  # @param links [Ittybit::LinksList]
28
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
33
  # @return [Ittybit::AutomationListResponse]
30
- def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
34
+ def initialize(meta: OMIT, data: OMIT, error: OMIT, links: OMIT, additional_properties: nil)
31
35
  @meta = meta if meta != OMIT
32
36
  @data = data if data != OMIT
37
+ @error = error if error != OMIT
33
38
  @links = links if links != OMIT
34
39
  @additional_properties = additional_properties
35
- @_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
40
+ @_field_set = { "meta": meta, "data": data, "error": error, "links": links }.reject do |_k, v|
36
41
  v == OMIT
37
42
  end
38
43
  end
@@ -54,6 +59,12 @@ module Ittybit
54
59
  item = item.to_json
55
60
  Ittybit::Automation.from_json(json_object: item)
56
61
  end
62
+ if parsed_json["error"].nil?
63
+ error = nil
64
+ else
65
+ error = parsed_json["error"].to_json
66
+ error = Ittybit::Error.from_json(json_object: error)
67
+ end
57
68
  if parsed_json["links"].nil?
58
69
  links = nil
59
70
  else
@@ -63,6 +74,7 @@ module Ittybit
63
74
  new(
64
75
  meta: meta,
65
76
  data: data,
77
+ error: error,
66
78
  links: links,
67
79
  additional_properties: struct
68
80
  )
@@ -84,6 +96,7 @@ module Ittybit
84
96
  def self.validate_raw(obj:)
85
97
  obj.meta.nil? || Ittybit::MetaList.validate_raw(obj: obj.meta)
86
98
  obj.data&.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
99
+ obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
87
100
  obj.links.nil? || Ittybit::LinksList.validate_raw(obj: obj.links)
88
101
  end
89
102
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "meta"
4
4
  require_relative "automation"
5
+ require_relative "error"
5
6
  require_relative "links"
6
7
  require "ostruct"
7
8
  require "json"
@@ -12,6 +13,8 @@ module Ittybit
12
13
  attr_reader :meta
13
14
  # @return [Ittybit::Automation]
14
15
  attr_reader :data
16
+ # @return [Ittybit::Error]
17
+ attr_reader :error
15
18
  # @return [Ittybit::Links]
16
19
  attr_reader :links
17
20
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -24,15 +27,17 @@ module Ittybit
24
27
 
25
28
  # @param meta [Ittybit::META]
26
29
  # @param data [Ittybit::Automation]
30
+ # @param error [Ittybit::Error]
27
31
  # @param links [Ittybit::Links]
28
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
33
  # @return [Ittybit::AutomationResponse]
30
- def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
34
+ def initialize(meta: OMIT, data: OMIT, error: OMIT, links: OMIT, additional_properties: nil)
31
35
  @meta = meta if meta != OMIT
32
36
  @data = data if data != OMIT
37
+ @error = error if error != OMIT
33
38
  @links = links if links != OMIT
34
39
  @additional_properties = additional_properties
35
- @_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
40
+ @_field_set = { "meta": meta, "data": data, "error": error, "links": links }.reject do |_k, v|
36
41
  v == OMIT
37
42
  end
38
43
  end
@@ -51,6 +56,12 @@ module Ittybit
51
56
  data = parsed_json["data"].to_json
52
57
  data = Ittybit::Automation.from_json(json_object: data)
53
58
  end
59
+ if parsed_json["error"].nil?
60
+ error = nil
61
+ else
62
+ error = parsed_json["error"].to_json
63
+ error = Ittybit::Error.from_json(json_object: error)
64
+ end
54
65
  if parsed_json["links"].nil?
55
66
  links = nil
56
67
  else
@@ -60,6 +71,7 @@ module Ittybit
60
71
  new(
61
72
  meta: meta,
62
73
  data: data,
74
+ error: error,
63
75
  links: links,
64
76
  additional_properties: struct
65
77
  )
@@ -81,6 +93,7 @@ module Ittybit
81
93
  def self.validate_raw(obj:)
82
94
  obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
83
95
  obj.data.nil? || Ittybit::Automation.validate_raw(obj: obj.data)
96
+ obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
84
97
  obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
85
98
  end
86
99
  end
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ittybit
4
- # Current status of the automation
5
4
  class AutomationStatus
6
5
  ACTIVE = "active"
7
- INACTIVE = "inactive"
8
- DRAFT = "draft"
6
+ PAUSED = "paused"
9
7
  end
10
8
  end
@@ -1,16 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "automation_trigger_conditions_item"
4
3
  require "ostruct"
5
4
  require "json"
6
5
 
7
6
  module Ittybit
8
- # The event and conditions that trigger this automation.
9
7
  class AutomationTrigger
10
- # @return [String] The event that triggers the automation
8
+ # @return [String]
9
+ attr_reader :kind
10
+ # @return [String]
11
11
  attr_reader :event
12
- # @return [Array<Ittybit::AutomationTriggerConditionsItem>] Conditions that must be met for the trigger to activate.
13
- attr_reader :conditions
14
12
  # @return [OpenStruct] Additional properties unmapped to the current class definition
15
13
  attr_reader :additional_properties
16
14
  # @return [Object]
@@ -19,17 +17,15 @@ module Ittybit
19
17
 
20
18
  OMIT = Object.new
21
19
 
22
- # @param event [String] The event that triggers the automation
23
- # @param conditions [Array<Ittybit::AutomationTriggerConditionsItem>] Conditions that must be met for the trigger to activate.
20
+ # @param kind [String]
21
+ # @param event [String]
24
22
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
23
  # @return [Ittybit::AutomationTrigger]
26
- def initialize(event:, conditions: OMIT, additional_properties: nil)
24
+ def initialize(kind:, event:, additional_properties: nil)
25
+ @kind = kind
27
26
  @event = event
28
- @conditions = conditions if conditions != OMIT
29
27
  @additional_properties = additional_properties
30
- @_field_set = { "event": event, "conditions": conditions }.reject do |_k, v|
31
- v == OMIT
32
- end
28
+ @_field_set = { "kind": kind, "event": event }
33
29
  end
34
30
 
35
31
  # Deserialize a JSON object to an instance of AutomationTrigger
@@ -39,14 +35,11 @@ module Ittybit
39
35
  def self.from_json(json_object:)
40
36
  struct = JSON.parse(json_object, object_class: OpenStruct)
41
37
  parsed_json = JSON.parse(json_object)
38
+ kind = parsed_json["kind"]
42
39
  event = parsed_json["event"]
43
- conditions = parsed_json["conditions"]&.map do |item|
44
- item = item.to_json
45
- Ittybit::AutomationTriggerConditionsItem.from_json(json_object: item)
46
- end
47
40
  new(
41
+ kind: kind,
48
42
  event: event,
49
- conditions: conditions,
50
43
  additional_properties: struct
51
44
  )
52
45
  end
@@ -65,8 +58,8 @@ module Ittybit
65
58
  # @param obj [Object]
66
59
  # @return [Void]
67
60
  def self.validate_raw(obj:)
61
+ obj.kind.is_a?(String) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
68
62
  obj.event.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.")
69
- obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.")
70
63
  end
71
64
  end
72
65
  end