ittybit 0.7.4
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 +7 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/ittybit/automations/client.rb +412 -0
- data/lib/ittybit/automations/types/automations_update_request_trigger.rb +75 -0
- data/lib/ittybit/automations/types/automations_update_request_trigger_conditions_item.rb +69 -0
- data/lib/ittybit/files/client.rb +437 -0
- data/lib/ittybit/files/types/files_delete_response.rb +89 -0
- data/lib/ittybit/files/types/files_delete_response_data.rb +60 -0
- data/lib/ittybit/media/client.rb +367 -0
- data/lib/ittybit/signatures/client.rb +132 -0
- data/lib/ittybit/signatures/types/signatures_create_request_method.rb +13 -0
- data/lib/ittybit/tasks/client.rb +379 -0
- data/lib/ittybit/tasks/types/tasks_create_request_kind.rb +22 -0
- data/lib/ittybit/tasks/types/tasks_list_request_kind.rb +26 -0
- data/lib/ittybit/tasks/types/tasks_list_request_status.rb +16 -0
- data/lib/ittybit/types/api_response_base.rb +5 -0
- data/lib/ittybit/types/automation.rb +141 -0
- data/lib/ittybit/types/automation_list_response.rb +90 -0
- data/lib/ittybit/types/automation_response.rb +87 -0
- data/lib/ittybit/types/automation_status.rb +10 -0
- data/lib/ittybit/types/automation_trigger.rb +72 -0
- data/lib/ittybit/types/automation_trigger_conditions_item.rb +65 -0
- data/lib/ittybit/types/confirmation_response.rb +87 -0
- data/lib/ittybit/types/confirmation_response_data.rb +55 -0
- data/lib/ittybit/types/error.rb +57 -0
- data/lib/ittybit/types/error_response.rb +74 -0
- data/lib/ittybit/types/file.rb +319 -0
- data/lib/ittybit/types/file_kind.rb +10 -0
- data/lib/ittybit/types/file_list_response.rb +90 -0
- data/lib/ittybit/types/file_object.rb +10 -0
- data/lib/ittybit/types/file_response.rb +87 -0
- data/lib/ittybit/types/file_status.rb +11 -0
- data/lib/ittybit/types/links.rb +67 -0
- data/lib/ittybit/types/links_list.rb +103 -0
- data/lib/ittybit/types/media.rb +195 -0
- data/lib/ittybit/types/media_kind.rb +10 -0
- data/lib/ittybit/types/media_list_response.rb +90 -0
- data/lib/ittybit/types/media_response.rb +87 -0
- data/lib/ittybit/types/media_source.rb +261 -0
- data/lib/ittybit/types/media_source_kind.rb +10 -0
- data/lib/ittybit/types/media_source_object.rb +10 -0
- data/lib/ittybit/types/media_source_status.rb +11 -0
- data/lib/ittybit/types/media_urls.rb +70 -0
- data/lib/ittybit/types/meta.rb +5 -0
- data/lib/ittybit/types/meta_list.rb +103 -0
- data/lib/ittybit/types/signature.rb +110 -0
- data/lib/ittybit/types/signature_response.rb +87 -0
- data/lib/ittybit/types/task.rb +204 -0
- data/lib/ittybit/types/task_kind.rb +5 -0
- data/lib/ittybit/types/task_list_response.rb +90 -0
- data/lib/ittybit/types/task_response.rb +87 -0
- data/lib/ittybit/types/task_results.rb +74 -0
- data/lib/ittybit/types/task_status.rb +15 -0
- data/lib/ittybit/types/task_summary.rb +138 -0
- data/lib/ittybit/types/task_summary_kind.rb +25 -0
- data/lib/ittybit/types/task_summary_status.rb +15 -0
- data/lib/ittybit/types/workflow_task_step.rb +112 -0
- data/lib/ittybit/types/workflow_task_step_kind.rb +25 -0
- data/lib/ittybit.rb +86 -0
- data/lib/requests.rb +177 -0
- data/lib/types_export.rb +53 -0
- metadata +185 -0
@@ -0,0 +1,204 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "task_kind"
|
4
|
+
require_relative "task_status"
|
5
|
+
require "date"
|
6
|
+
require_relative "task_results"
|
7
|
+
require "ostruct"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
module Ittybit
|
11
|
+
class Task
|
12
|
+
# @return [String] Unique identifier for the task.
|
13
|
+
attr_reader :id
|
14
|
+
# @return [String] Object type, always 'task'.
|
15
|
+
attr_reader :object
|
16
|
+
# @return [Ittybit::TASK_KIND] The type of operation the task performs.
|
17
|
+
attr_reader :kind
|
18
|
+
# @return [Hash{String => Object}] The input source for the task (e.g., details of a file). Structure varies based
|
19
|
+
# on the task kind and preceding steps.
|
20
|
+
attr_reader :input
|
21
|
+
# @return [Hash{String => Object}] Configuration options specific to the task kind.
|
22
|
+
attr_reader :options
|
23
|
+
# @return [Hash{String => Object}] The result generated by the task (e.g., details of an output file or
|
24
|
+
# intelligence data). Structure varies.
|
25
|
+
attr_reader :output
|
26
|
+
# @return [Ittybit::TaskStatus] Current status of the task.
|
27
|
+
attr_reader :status
|
28
|
+
# @return [Integer] Task progress percentage.
|
29
|
+
attr_reader :progress
|
30
|
+
# @return [String] Error message if the task failed.
|
31
|
+
attr_reader :error
|
32
|
+
# @return [String] ID of the entity that created the task (e.g., user ID, automation ID).
|
33
|
+
attr_reader :created_by
|
34
|
+
# @return [DateTime] Timestamp when the task was created.
|
35
|
+
attr_reader :created
|
36
|
+
# @return [DateTime] Timestamp when the task was last updated.
|
37
|
+
attr_reader :updated
|
38
|
+
# @return [String] ID of the parent task if this is part of a workflow.
|
39
|
+
attr_reader :parent_id
|
40
|
+
# @return [Array<Ittybit::Task>] Array of nested task objects representing the steps within this workflow task.
|
41
|
+
attr_reader :workflow
|
42
|
+
# @return [Array<Ittybit::Task>] Array representing subsequent tasks (e.g., in an automation). Structure may
|
43
|
+
# vary.
|
44
|
+
attr_reader :next_
|
45
|
+
# @return [Ittybit::TaskResults]
|
46
|
+
attr_reader :results
|
47
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
48
|
+
attr_reader :additional_properties
|
49
|
+
# @return [Object]
|
50
|
+
attr_reader :_field_set
|
51
|
+
protected :_field_set
|
52
|
+
|
53
|
+
OMIT = Object.new
|
54
|
+
|
55
|
+
# @param id [String] Unique identifier for the task.
|
56
|
+
# @param object [String] Object type, always 'task'.
|
57
|
+
# @param kind [Ittybit::TASK_KIND] The type of operation the task performs.
|
58
|
+
# @param input [Hash{String => Object}] The input source for the task (e.g., details of a file). Structure varies based
|
59
|
+
# on the task kind and preceding steps.
|
60
|
+
# @param options [Hash{String => Object}] Configuration options specific to the task kind.
|
61
|
+
# @param output [Hash{String => Object}] The result generated by the task (e.g., details of an output file or
|
62
|
+
# intelligence data). Structure varies.
|
63
|
+
# @param status [Ittybit::TaskStatus] Current status of the task.
|
64
|
+
# @param progress [Integer] Task progress percentage.
|
65
|
+
# @param error [String] Error message if the task failed.
|
66
|
+
# @param created_by [String] ID of the entity that created the task (e.g., user ID, automation ID).
|
67
|
+
# @param created [DateTime] Timestamp when the task was created.
|
68
|
+
# @param updated [DateTime] Timestamp when the task was last updated.
|
69
|
+
# @param parent_id [String] ID of the parent task if this is part of a workflow.
|
70
|
+
# @param workflow [Array<Ittybit::Task>] Array of nested task objects representing the steps within this workflow task.
|
71
|
+
# @param next_ [Array<Ittybit::Task>] Array representing subsequent tasks (e.g., in an automation). Structure may
|
72
|
+
# vary.
|
73
|
+
# @param results [Ittybit::TaskResults]
|
74
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
75
|
+
# @return [Ittybit::Task]
|
76
|
+
def initialize(id:, object:, kind:, status:, created:, updated:, input: OMIT, options: OMIT, output: OMIT, progress: OMIT, error: OMIT,
|
77
|
+
created_by: OMIT, parent_id: OMIT, workflow: OMIT, next_: OMIT, results: OMIT, additional_properties: nil)
|
78
|
+
@id = id
|
79
|
+
@object = object
|
80
|
+
@kind = kind
|
81
|
+
@input = input if input != OMIT
|
82
|
+
@options = options if options != OMIT
|
83
|
+
@output = output if output != OMIT
|
84
|
+
@status = status
|
85
|
+
@progress = progress if progress != OMIT
|
86
|
+
@error = error if error != OMIT
|
87
|
+
@created_by = created_by if created_by != OMIT
|
88
|
+
@created = created
|
89
|
+
@updated = updated
|
90
|
+
@parent_id = parent_id if parent_id != OMIT
|
91
|
+
@workflow = workflow if workflow != OMIT
|
92
|
+
@next_ = next_ if next_ != OMIT
|
93
|
+
@results = results if results != OMIT
|
94
|
+
@additional_properties = additional_properties
|
95
|
+
@_field_set = {
|
96
|
+
"id": id,
|
97
|
+
"object": object,
|
98
|
+
"kind": kind,
|
99
|
+
"input": input,
|
100
|
+
"options": options,
|
101
|
+
"output": output,
|
102
|
+
"status": status,
|
103
|
+
"progress": progress,
|
104
|
+
"error": error,
|
105
|
+
"created_by": created_by,
|
106
|
+
"created": created,
|
107
|
+
"updated": updated,
|
108
|
+
"parent_id": parent_id,
|
109
|
+
"workflow": workflow,
|
110
|
+
"next": next_,
|
111
|
+
"results": results
|
112
|
+
}.reject do |_k, v|
|
113
|
+
v == OMIT
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Deserialize a JSON object to an instance of Task
|
118
|
+
#
|
119
|
+
# @param json_object [String]
|
120
|
+
# @return [Ittybit::Task]
|
121
|
+
def self.from_json(json_object:)
|
122
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
123
|
+
parsed_json = JSON.parse(json_object)
|
124
|
+
id = parsed_json["id"]
|
125
|
+
object = parsed_json["object"]
|
126
|
+
kind = parsed_json["kind"]
|
127
|
+
input = parsed_json["input"]
|
128
|
+
options = parsed_json["options"]
|
129
|
+
output = parsed_json["output"]
|
130
|
+
status = parsed_json["status"]
|
131
|
+
progress = parsed_json["progress"]
|
132
|
+
error = parsed_json["error"]
|
133
|
+
created_by = parsed_json["created_by"]
|
134
|
+
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
135
|
+
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
136
|
+
parent_id = parsed_json["parent_id"]
|
137
|
+
workflow = parsed_json["workflow"]&.map do |item|
|
138
|
+
item = item.to_json
|
139
|
+
Ittybit::Task.from_json(json_object: item)
|
140
|
+
end
|
141
|
+
next_ = parsed_json["next"]&.map do |item|
|
142
|
+
item = item.to_json
|
143
|
+
Ittybit::Task.from_json(json_object: item)
|
144
|
+
end
|
145
|
+
if parsed_json["results"].nil?
|
146
|
+
results = nil
|
147
|
+
else
|
148
|
+
results = parsed_json["results"].to_json
|
149
|
+
results = Ittybit::TaskResults.from_json(json_object: results)
|
150
|
+
end
|
151
|
+
new(
|
152
|
+
id: id,
|
153
|
+
object: object,
|
154
|
+
kind: kind,
|
155
|
+
input: input,
|
156
|
+
options: options,
|
157
|
+
output: output,
|
158
|
+
status: status,
|
159
|
+
progress: progress,
|
160
|
+
error: error,
|
161
|
+
created_by: created_by,
|
162
|
+
created: created,
|
163
|
+
updated: updated,
|
164
|
+
parent_id: parent_id,
|
165
|
+
workflow: workflow,
|
166
|
+
next_: next_,
|
167
|
+
results: results,
|
168
|
+
additional_properties: struct
|
169
|
+
)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Serialize an instance of Task to a JSON object
|
173
|
+
#
|
174
|
+
# @return [String]
|
175
|
+
def to_json(*_args)
|
176
|
+
@_field_set&.to_json
|
177
|
+
end
|
178
|
+
|
179
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
180
|
+
# hash and check each fields type against the current object's property
|
181
|
+
# definitions.
|
182
|
+
#
|
183
|
+
# @param obj [Object]
|
184
|
+
# @return [Void]
|
185
|
+
def self.validate_raw(obj:)
|
186
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
187
|
+
obj.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
|
188
|
+
obj.kind.is_a?(Object) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
189
|
+
obj.input&.is_a?(Hash) != false || raise("Passed value for field obj.input is not the expected type, validation failed.")
|
190
|
+
obj.options&.is_a?(Hash) != false || raise("Passed value for field obj.options is not the expected type, validation failed.")
|
191
|
+
obj.output&.is_a?(Hash) != false || raise("Passed value for field obj.output is not the expected type, validation failed.")
|
192
|
+
obj.status.is_a?(Ittybit::TaskStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
193
|
+
obj.progress&.is_a?(Integer) != false || raise("Passed value for field obj.progress is not the expected type, validation failed.")
|
194
|
+
obj.error&.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
|
195
|
+
obj.created_by&.is_a?(String) != false || raise("Passed value for field obj.created_by is not the expected type, validation failed.")
|
196
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
197
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
198
|
+
obj.parent_id&.is_a?(String) != false || raise("Passed value for field obj.parent_id is not the expected type, validation failed.")
|
199
|
+
obj.workflow&.is_a?(Array) != false || raise("Passed value for field obj.workflow is not the expected type, validation failed.")
|
200
|
+
obj.next_&.is_a?(Array) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
|
201
|
+
obj.results.nil? || Ittybit::TaskResults.validate_raw(obj: obj.results)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "meta_list"
|
4
|
+
require_relative "task"
|
5
|
+
require_relative "links_list"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Ittybit
|
10
|
+
class TaskListResponse
|
11
|
+
# @return [Ittybit::MetaList]
|
12
|
+
attr_reader :meta
|
13
|
+
# @return [Array<Ittybit::Task>]
|
14
|
+
attr_reader :data
|
15
|
+
# @return [Ittybit::LinksList]
|
16
|
+
attr_reader :links
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param meta [Ittybit::MetaList]
|
26
|
+
# @param data [Array<Ittybit::Task>]
|
27
|
+
# @param links [Ittybit::LinksList]
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [Ittybit::TaskListResponse]
|
30
|
+
def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
|
31
|
+
@meta = meta if meta != OMIT
|
32
|
+
@data = data if data != OMIT
|
33
|
+
@links = links if links != OMIT
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
@_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
|
36
|
+
v == OMIT
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Deserialize a JSON object to an instance of TaskListResponse
|
41
|
+
#
|
42
|
+
# @param json_object [String]
|
43
|
+
# @return [Ittybit::TaskListResponse]
|
44
|
+
def self.from_json(json_object:)
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
46
|
+
parsed_json = JSON.parse(json_object)
|
47
|
+
if parsed_json["meta"].nil?
|
48
|
+
meta = nil
|
49
|
+
else
|
50
|
+
meta = parsed_json["meta"].to_json
|
51
|
+
meta = Ittybit::MetaList.from_json(json_object: meta)
|
52
|
+
end
|
53
|
+
data = parsed_json["data"]&.map do |item|
|
54
|
+
item = item.to_json
|
55
|
+
Ittybit::Task.from_json(json_object: item)
|
56
|
+
end
|
57
|
+
if parsed_json["links"].nil?
|
58
|
+
links = nil
|
59
|
+
else
|
60
|
+
links = parsed_json["links"].to_json
|
61
|
+
links = Ittybit::LinksList.from_json(json_object: links)
|
62
|
+
end
|
63
|
+
new(
|
64
|
+
meta: meta,
|
65
|
+
data: data,
|
66
|
+
links: links,
|
67
|
+
additional_properties: struct
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Serialize an instance of TaskListResponse to a JSON object
|
72
|
+
#
|
73
|
+
# @return [String]
|
74
|
+
def to_json(*_args)
|
75
|
+
@_field_set&.to_json
|
76
|
+
end
|
77
|
+
|
78
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
79
|
+
# hash and check each fields type against the current object's property
|
80
|
+
# definitions.
|
81
|
+
#
|
82
|
+
# @param obj [Object]
|
83
|
+
# @return [Void]
|
84
|
+
def self.validate_raw(obj:)
|
85
|
+
obj.meta.nil? || Ittybit::MetaList.validate_raw(obj: obj.meta)
|
86
|
+
obj.data&.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
|
87
|
+
obj.links.nil? || Ittybit::LinksList.validate_raw(obj: obj.links)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "meta"
|
4
|
+
require_relative "task"
|
5
|
+
require_relative "links"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Ittybit
|
10
|
+
class TaskResponse
|
11
|
+
# @return [Ittybit::META]
|
12
|
+
attr_reader :meta
|
13
|
+
# @return [Ittybit::Task]
|
14
|
+
attr_reader :data
|
15
|
+
# @return [Ittybit::Links]
|
16
|
+
attr_reader :links
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param meta [Ittybit::META]
|
26
|
+
# @param data [Ittybit::Task]
|
27
|
+
# @param links [Ittybit::Links]
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [Ittybit::TaskResponse]
|
30
|
+
def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
|
31
|
+
@meta = meta if meta != OMIT
|
32
|
+
@data = data if data != OMIT
|
33
|
+
@links = links if links != OMIT
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
@_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
|
36
|
+
v == OMIT
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Deserialize a JSON object to an instance of TaskResponse
|
41
|
+
#
|
42
|
+
# @param json_object [String]
|
43
|
+
# @return [Ittybit::TaskResponse]
|
44
|
+
def self.from_json(json_object:)
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
46
|
+
parsed_json = JSON.parse(json_object)
|
47
|
+
meta = parsed_json["meta"]
|
48
|
+
if parsed_json["data"].nil?
|
49
|
+
data = nil
|
50
|
+
else
|
51
|
+
data = parsed_json["data"].to_json
|
52
|
+
data = Ittybit::Task.from_json(json_object: data)
|
53
|
+
end
|
54
|
+
if parsed_json["links"].nil?
|
55
|
+
links = nil
|
56
|
+
else
|
57
|
+
links = parsed_json["links"].to_json
|
58
|
+
links = Ittybit::Links.from_json(json_object: links)
|
59
|
+
end
|
60
|
+
new(
|
61
|
+
meta: meta,
|
62
|
+
data: data,
|
63
|
+
links: links,
|
64
|
+
additional_properties: struct
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Serialize an instance of TaskResponse to a JSON object
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
def to_json(*_args)
|
72
|
+
@_field_set&.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
76
|
+
# hash and check each fields type against the current object's property
|
77
|
+
# definitions.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Void]
|
81
|
+
def self.validate_raw(obj:)
|
82
|
+
obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
|
83
|
+
obj.data.nil? || Ittybit::Task.validate_raw(obj: obj.data)
|
84
|
+
obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
class TaskResults
|
8
|
+
# @return [Array<Hash{String => Object}>]
|
9
|
+
attr_reader :passed
|
10
|
+
# @return [Array<Hash{String => Object}>]
|
11
|
+
attr_reader :failed
|
12
|
+
# @return [Boolean]
|
13
|
+
attr_reader :continue
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param passed [Array<Hash{String => Object}>]
|
23
|
+
# @param failed [Array<Hash{String => Object}>]
|
24
|
+
# @param continue [Boolean]
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Ittybit::TaskResults]
|
27
|
+
def initialize(passed: OMIT, failed: OMIT, continue: OMIT, additional_properties: nil)
|
28
|
+
@passed = passed if passed != OMIT
|
29
|
+
@failed = failed if failed != OMIT
|
30
|
+
@continue = continue if continue != OMIT
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "passed": passed, "failed": failed, "continue": continue }.reject do |_k, v|
|
33
|
+
v == OMIT
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of TaskResults
|
38
|
+
#
|
39
|
+
# @param json_object [String]
|
40
|
+
# @return [Ittybit::TaskResults]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
passed = parsed_json["passed"]
|
45
|
+
failed = parsed_json["failed"]
|
46
|
+
continue = parsed_json["continue"]
|
47
|
+
new(
|
48
|
+
passed: passed,
|
49
|
+
failed: failed,
|
50
|
+
continue: continue,
|
51
|
+
additional_properties: struct
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Serialize an instance of TaskResults to a JSON object
|
56
|
+
#
|
57
|
+
# @return [String]
|
58
|
+
def to_json(*_args)
|
59
|
+
@_field_set&.to_json
|
60
|
+
end
|
61
|
+
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
63
|
+
# hash and check each fields type against the current object's property
|
64
|
+
# definitions.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.passed&.is_a?(Array) != false || raise("Passed value for field obj.passed is not the expected type, validation failed.")
|
70
|
+
obj.failed&.is_a?(Array) != false || raise("Passed value for field obj.failed is not the expected type, validation failed.")
|
71
|
+
obj.continue&.is_a?(Boolean) != false || raise("Passed value for field obj.continue is not the expected type, validation failed.")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ittybit
|
4
|
+
# Current status of the task.
|
5
|
+
class TaskStatus
|
6
|
+
PENDING = "pending"
|
7
|
+
WAITING = "waiting"
|
8
|
+
PROCESSING = "processing"
|
9
|
+
READY = "ready"
|
10
|
+
COMPLETED = "completed"
|
11
|
+
FAILED = "failed"
|
12
|
+
ERROR = "error"
|
13
|
+
CANCELLED = "cancelled"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "task_summary_kind"
|
4
|
+
require_relative "task_summary_status"
|
5
|
+
require "date"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Ittybit
|
10
|
+
class TaskSummary
|
11
|
+
# @return [String] Unique identifier for the task.
|
12
|
+
attr_reader :id
|
13
|
+
# @return [String] Object type, always 'task'.
|
14
|
+
attr_reader :object
|
15
|
+
# @return [Ittybit::TaskSummaryKind] The type of operation the task performs.
|
16
|
+
attr_reader :kind
|
17
|
+
# @return [Ittybit::TaskSummaryStatus] Current status of the task.
|
18
|
+
attr_reader :status
|
19
|
+
# @return [Integer] Task progress percentage.
|
20
|
+
attr_reader :progress
|
21
|
+
# @return [String] Error message if the task failed.
|
22
|
+
attr_reader :error
|
23
|
+
# @return [String] ID of the entity that created the task (e.g., user ID, automation ID).
|
24
|
+
attr_reader :created_by
|
25
|
+
# @return [DateTime] Timestamp when the task was created.
|
26
|
+
attr_reader :created
|
27
|
+
# @return [DateTime] Timestamp when the task was last updated.
|
28
|
+
attr_reader :updated
|
29
|
+
# @return [String] ID of the parent task if this is part of a workflow.
|
30
|
+
attr_reader :parent_id
|
31
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
32
|
+
attr_reader :additional_properties
|
33
|
+
# @return [Object]
|
34
|
+
attr_reader :_field_set
|
35
|
+
protected :_field_set
|
36
|
+
|
37
|
+
OMIT = Object.new
|
38
|
+
|
39
|
+
# @param id [String] Unique identifier for the task.
|
40
|
+
# @param object [String] Object type, always 'task'.
|
41
|
+
# @param kind [Ittybit::TaskSummaryKind] The type of operation the task performs.
|
42
|
+
# @param status [Ittybit::TaskSummaryStatus] Current status of the task.
|
43
|
+
# @param progress [Integer] Task progress percentage.
|
44
|
+
# @param error [String] Error message if the task failed.
|
45
|
+
# @param created_by [String] ID of the entity that created the task (e.g., user ID, automation ID).
|
46
|
+
# @param created [DateTime] Timestamp when the task was created.
|
47
|
+
# @param updated [DateTime] Timestamp when the task was last updated.
|
48
|
+
# @param parent_id [String] ID of the parent task if this is part of a workflow.
|
49
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
50
|
+
# @return [Ittybit::TaskSummary]
|
51
|
+
def initialize(id:, object:, kind:, status:, created:, updated:, progress: OMIT, error: OMIT, created_by: OMIT,
|
52
|
+
parent_id: OMIT, additional_properties: nil)
|
53
|
+
@id = id
|
54
|
+
@object = object
|
55
|
+
@kind = kind
|
56
|
+
@status = status
|
57
|
+
@progress = progress if progress != OMIT
|
58
|
+
@error = error if error != OMIT
|
59
|
+
@created_by = created_by if created_by != OMIT
|
60
|
+
@created = created
|
61
|
+
@updated = updated
|
62
|
+
@parent_id = parent_id if parent_id != OMIT
|
63
|
+
@additional_properties = additional_properties
|
64
|
+
@_field_set = {
|
65
|
+
"id": id,
|
66
|
+
"object": object,
|
67
|
+
"kind": kind,
|
68
|
+
"status": status,
|
69
|
+
"progress": progress,
|
70
|
+
"error": error,
|
71
|
+
"created_by": created_by,
|
72
|
+
"created": created,
|
73
|
+
"updated": updated,
|
74
|
+
"parent_id": parent_id
|
75
|
+
}.reject do |_k, v|
|
76
|
+
v == OMIT
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Deserialize a JSON object to an instance of TaskSummary
|
81
|
+
#
|
82
|
+
# @param json_object [String]
|
83
|
+
# @return [Ittybit::TaskSummary]
|
84
|
+
def self.from_json(json_object:)
|
85
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
86
|
+
parsed_json = JSON.parse(json_object)
|
87
|
+
id = parsed_json["id"]
|
88
|
+
object = parsed_json["object"]
|
89
|
+
kind = parsed_json["kind"]
|
90
|
+
status = parsed_json["status"]
|
91
|
+
progress = parsed_json["progress"]
|
92
|
+
error = parsed_json["error"]
|
93
|
+
created_by = parsed_json["created_by"]
|
94
|
+
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
95
|
+
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
96
|
+
parent_id = parsed_json["parent_id"]
|
97
|
+
new(
|
98
|
+
id: id,
|
99
|
+
object: object,
|
100
|
+
kind: kind,
|
101
|
+
status: status,
|
102
|
+
progress: progress,
|
103
|
+
error: error,
|
104
|
+
created_by: created_by,
|
105
|
+
created: created,
|
106
|
+
updated: updated,
|
107
|
+
parent_id: parent_id,
|
108
|
+
additional_properties: struct
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Serialize an instance of TaskSummary to a JSON object
|
113
|
+
#
|
114
|
+
# @return [String]
|
115
|
+
def to_json(*_args)
|
116
|
+
@_field_set&.to_json
|
117
|
+
end
|
118
|
+
|
119
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
120
|
+
# hash and check each fields type against the current object's property
|
121
|
+
# definitions.
|
122
|
+
#
|
123
|
+
# @param obj [Object]
|
124
|
+
# @return [Void]
|
125
|
+
def self.validate_raw(obj:)
|
126
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
127
|
+
obj.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
|
128
|
+
obj.kind.is_a?(Ittybit::TaskSummaryKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
129
|
+
obj.status.is_a?(Ittybit::TaskSummaryStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
130
|
+
obj.progress&.is_a?(Integer) != false || raise("Passed value for field obj.progress is not the expected type, validation failed.")
|
131
|
+
obj.error&.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
|
132
|
+
obj.created_by&.is_a?(String) != false || raise("Passed value for field obj.created_by is not the expected type, validation failed.")
|
133
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
134
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
135
|
+
obj.parent_id&.is_a?(String) != false || raise("Passed value for field obj.parent_id is not the expected type, validation failed.")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ittybit
|
4
|
+
# The type of operation the task performs.
|
5
|
+
class TaskSummaryKind
|
6
|
+
INGEST = "ingest"
|
7
|
+
WORKFLOW = "workflow"
|
8
|
+
SPEECH = "speech"
|
9
|
+
OUTLINE = "outline"
|
10
|
+
CHAPTERS = "chapters"
|
11
|
+
SUBTITLES = "subtitles"
|
12
|
+
THUMBNAILS = "thumbnails"
|
13
|
+
NSFW = "nsfw"
|
14
|
+
SUMMARY = "summary"
|
15
|
+
DESCRIBE = "describe"
|
16
|
+
VIDEO = "video"
|
17
|
+
IMAGE = "image"
|
18
|
+
AUDIO = "audio"
|
19
|
+
HTTP = "http"
|
20
|
+
CONDITIONS = "conditions"
|
21
|
+
STORE = "store"
|
22
|
+
PROMPT = "prompt"
|
23
|
+
TAGS = "tags"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ittybit
|
4
|
+
# Current status of the task.
|
5
|
+
class TaskSummaryStatus
|
6
|
+
PENDING = "pending"
|
7
|
+
WAITING = "waiting"
|
8
|
+
PROCESSING = "processing"
|
9
|
+
READY = "ready"
|
10
|
+
COMPLETED = "completed"
|
11
|
+
FAILED = "failed"
|
12
|
+
ERROR = "error"
|
13
|
+
CANCELLED = "cancelled"
|
14
|
+
end
|
15
|
+
end
|