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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/lib/environment.rb +7 -0
  3. data/lib/gemconfig.rb +14 -0
  4. data/lib/ittybit/automations/client.rb +412 -0
  5. data/lib/ittybit/automations/types/automations_update_request_trigger.rb +75 -0
  6. data/lib/ittybit/automations/types/automations_update_request_trigger_conditions_item.rb +69 -0
  7. data/lib/ittybit/files/client.rb +437 -0
  8. data/lib/ittybit/files/types/files_delete_response.rb +89 -0
  9. data/lib/ittybit/files/types/files_delete_response_data.rb +60 -0
  10. data/lib/ittybit/media/client.rb +367 -0
  11. data/lib/ittybit/signatures/client.rb +132 -0
  12. data/lib/ittybit/signatures/types/signatures_create_request_method.rb +13 -0
  13. data/lib/ittybit/tasks/client.rb +379 -0
  14. data/lib/ittybit/tasks/types/tasks_create_request_kind.rb +22 -0
  15. data/lib/ittybit/tasks/types/tasks_list_request_kind.rb +26 -0
  16. data/lib/ittybit/tasks/types/tasks_list_request_status.rb +16 -0
  17. data/lib/ittybit/types/api_response_base.rb +5 -0
  18. data/lib/ittybit/types/automation.rb +141 -0
  19. data/lib/ittybit/types/automation_list_response.rb +90 -0
  20. data/lib/ittybit/types/automation_response.rb +87 -0
  21. data/lib/ittybit/types/automation_status.rb +10 -0
  22. data/lib/ittybit/types/automation_trigger.rb +72 -0
  23. data/lib/ittybit/types/automation_trigger_conditions_item.rb +65 -0
  24. data/lib/ittybit/types/confirmation_response.rb +87 -0
  25. data/lib/ittybit/types/confirmation_response_data.rb +55 -0
  26. data/lib/ittybit/types/error.rb +57 -0
  27. data/lib/ittybit/types/error_response.rb +74 -0
  28. data/lib/ittybit/types/file.rb +319 -0
  29. data/lib/ittybit/types/file_kind.rb +10 -0
  30. data/lib/ittybit/types/file_list_response.rb +90 -0
  31. data/lib/ittybit/types/file_object.rb +10 -0
  32. data/lib/ittybit/types/file_response.rb +87 -0
  33. data/lib/ittybit/types/file_status.rb +11 -0
  34. data/lib/ittybit/types/links.rb +67 -0
  35. data/lib/ittybit/types/links_list.rb +103 -0
  36. data/lib/ittybit/types/media.rb +195 -0
  37. data/lib/ittybit/types/media_kind.rb +10 -0
  38. data/lib/ittybit/types/media_list_response.rb +90 -0
  39. data/lib/ittybit/types/media_response.rb +87 -0
  40. data/lib/ittybit/types/media_source.rb +261 -0
  41. data/lib/ittybit/types/media_source_kind.rb +10 -0
  42. data/lib/ittybit/types/media_source_object.rb +10 -0
  43. data/lib/ittybit/types/media_source_status.rb +11 -0
  44. data/lib/ittybit/types/media_urls.rb +70 -0
  45. data/lib/ittybit/types/meta.rb +5 -0
  46. data/lib/ittybit/types/meta_list.rb +103 -0
  47. data/lib/ittybit/types/signature.rb +110 -0
  48. data/lib/ittybit/types/signature_response.rb +87 -0
  49. data/lib/ittybit/types/task.rb +204 -0
  50. data/lib/ittybit/types/task_kind.rb +5 -0
  51. data/lib/ittybit/types/task_list_response.rb +90 -0
  52. data/lib/ittybit/types/task_response.rb +87 -0
  53. data/lib/ittybit/types/task_results.rb +74 -0
  54. data/lib/ittybit/types/task_status.rb +15 -0
  55. data/lib/ittybit/types/task_summary.rb +138 -0
  56. data/lib/ittybit/types/task_summary_kind.rb +25 -0
  57. data/lib/ittybit/types/task_summary_status.rb +15 -0
  58. data/lib/ittybit/types/workflow_task_step.rb +112 -0
  59. data/lib/ittybit/types/workflow_task_step_kind.rb +25 -0
  60. data/lib/ittybit.rb +86 -0
  61. data/lib/requests.rb +177 -0
  62. data/lib/types_export.rb +53 -0
  63. metadata +185 -0
@@ -0,0 +1,319 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "file_object"
4
+ require_relative "file_kind"
5
+ require "date"
6
+ require_relative "file_status"
7
+ require "ostruct"
8
+ require "json"
9
+
10
+ module Ittybit
11
+ class File
12
+ # @return [String] Unique identifier for the file.
13
+ attr_reader :id
14
+ # @return [String] Identifier for the parent media object.
15
+ attr_reader :media_id
16
+ # @return [Ittybit::FileObject] Object type
17
+ attr_reader :object
18
+ # @return [Ittybit::FileKind] The general type of media.
19
+ attr_reader :kind
20
+ # @return [String] MIME type.
21
+ attr_reader :type
22
+ # @return [String] Codec of the file.
23
+ attr_reader :codec
24
+ # @return [String] Container of the file.
25
+ attr_reader :container
26
+ # @return [Integer] Width in pixels (for image/video).
27
+ attr_reader :width
28
+ # @return [Integer] Height in pixels (for image/video).
29
+ attr_reader :height
30
+ # @return [String] Orientation of the file.
31
+ attr_reader :orientation
32
+ # @return [Float] Rotation value for image files with embedded EXIF data.
33
+ attr_reader :rotation
34
+ # @return [Boolean] Indicates if the file has alpha channel.
35
+ attr_reader :transparency
36
+ # @return [Boolean] Indicates if the file is animated (image only).
37
+ attr_reader :animated
38
+ # @return [Integer] Number of frames in the file.
39
+ attr_reader :frames
40
+ # @return [Float] Duration in seconds (for audio/video).
41
+ attr_reader :duration
42
+ # @return [Float] Frames per second (for video).
43
+ attr_reader :fps
44
+ # @return [Integer] File size in bytes.
45
+ attr_reader :filesize
46
+ # @return [Integer] Bitrate for audio/video files.
47
+ attr_reader :bitrate
48
+ # @return [String] Language code (e.g., en, es, fr).
49
+ attr_reader :language
50
+ # @return [String] Label to be used by players (tracks only).
51
+ attr_reader :label
52
+ # @return [String] Optional reference value. If set, the file URL will be included in the parent
53
+ # media `urls` object.
54
+ attr_reader :ref
55
+ # @return [String] The folder path where the file is stored.
56
+ attr_reader :folder
57
+ # @return [String] The name of the file.
58
+ attr_reader :filename
59
+ # @return [String] Publicly accessible URL for the file.
60
+ attr_reader :url
61
+ # @return [String] Base64 encoded placeholder image for the file.
62
+ attr_reader :placeholder
63
+ # @return [String] Dominant background color hex code.
64
+ attr_reader :background
65
+ # @return [Hash{String => Object}] User-defined key-value metadata.
66
+ attr_reader :metadata
67
+ # @return [Boolean] Indicates this is the original file rather than a variant.
68
+ attr_reader :original
69
+ # @return [String] ID of the entity (e.g., task, automation, or upload request) that created this
70
+ # file.
71
+ attr_reader :created_by
72
+ # @return [DateTime] Timestamp when the file record was created.
73
+ attr_reader :created
74
+ # @return [DateTime] Timestamp when the file record was last updated.
75
+ attr_reader :updated
76
+ # @return [Ittybit::FileStatus] Processing status of the file.
77
+ attr_reader :status
78
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
79
+ attr_reader :additional_properties
80
+ # @return [Object]
81
+ attr_reader :_field_set
82
+ protected :_field_set
83
+
84
+ OMIT = Object.new
85
+
86
+ # @param id [String] Unique identifier for the file.
87
+ # @param media_id [String] Identifier for the parent media object.
88
+ # @param object [Ittybit::FileObject] Object type
89
+ # @param kind [Ittybit::FileKind] The general type of media.
90
+ # @param type [String] MIME type.
91
+ # @param codec [String] Codec of the file.
92
+ # @param container [String] Container of the file.
93
+ # @param width [Integer] Width in pixels (for image/video).
94
+ # @param height [Integer] Height in pixels (for image/video).
95
+ # @param orientation [String] Orientation of the file.
96
+ # @param rotation [Float] Rotation value for image files with embedded EXIF data.
97
+ # @param transparency [Boolean] Indicates if the file has alpha channel.
98
+ # @param animated [Boolean] Indicates if the file is animated (image only).
99
+ # @param frames [Integer] Number of frames in the file.
100
+ # @param duration [Float] Duration in seconds (for audio/video).
101
+ # @param fps [Float] Frames per second (for video).
102
+ # @param filesize [Integer] File size in bytes.
103
+ # @param bitrate [Integer] Bitrate for audio/video files.
104
+ # @param language [String] Language code (e.g., en, es, fr).
105
+ # @param label [String] Label to be used by players (tracks only).
106
+ # @param ref [String] Optional reference value. If set, the file URL will be included in the parent
107
+ # media `urls` object.
108
+ # @param folder [String] The folder path where the file is stored.
109
+ # @param filename [String] The name of the file.
110
+ # @param url [String] Publicly accessible URL for the file.
111
+ # @param placeholder [String] Base64 encoded placeholder image for the file.
112
+ # @param background [String] Dominant background color hex code.
113
+ # @param metadata [Hash{String => Object}] User-defined key-value metadata.
114
+ # @param original [Boolean] Indicates this is the original file rather than a variant.
115
+ # @param created_by [String] ID of the entity (e.g., task, automation, or upload request) that created this
116
+ # file.
117
+ # @param created [DateTime] Timestamp when the file record was created.
118
+ # @param updated [DateTime] Timestamp when the file record was last updated.
119
+ # @param status [Ittybit::FileStatus] Processing status of the file.
120
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
121
+ # @return [Ittybit::File]
122
+ def initialize(id:, media_id:, object:, kind:, type:, filesize:, url:, created:, updated:, status:, codec: OMIT, container: OMIT, width: OMIT, height: OMIT,
123
+ orientation: OMIT, rotation: OMIT, transparency: OMIT, animated: OMIT, frames: OMIT, duration: OMIT, fps: OMIT, bitrate: OMIT, language: OMIT, label: OMIT, ref: OMIT, folder: OMIT, filename: OMIT, placeholder: OMIT, background: OMIT, metadata: OMIT, original: OMIT, created_by: OMIT, additional_properties: nil)
124
+ @id = id
125
+ @media_id = media_id
126
+ @object = object
127
+ @kind = kind
128
+ @type = type
129
+ @codec = codec if codec != OMIT
130
+ @container = container if container != OMIT
131
+ @width = width if width != OMIT
132
+ @height = height if height != OMIT
133
+ @orientation = orientation if orientation != OMIT
134
+ @rotation = rotation if rotation != OMIT
135
+ @transparency = transparency if transparency != OMIT
136
+ @animated = animated if animated != OMIT
137
+ @frames = frames if frames != OMIT
138
+ @duration = duration if duration != OMIT
139
+ @fps = fps if fps != OMIT
140
+ @filesize = filesize
141
+ @bitrate = bitrate if bitrate != OMIT
142
+ @language = language if language != OMIT
143
+ @label = label if label != OMIT
144
+ @ref = ref if ref != OMIT
145
+ @folder = folder if folder != OMIT
146
+ @filename = filename if filename != OMIT
147
+ @url = url
148
+ @placeholder = placeholder if placeholder != OMIT
149
+ @background = background if background != OMIT
150
+ @metadata = metadata if metadata != OMIT
151
+ @original = original if original != OMIT
152
+ @created_by = created_by if created_by != OMIT
153
+ @created = created
154
+ @updated = updated
155
+ @status = status
156
+ @additional_properties = additional_properties
157
+ @_field_set = {
158
+ "id": id,
159
+ "media_id": media_id,
160
+ "object": object,
161
+ "kind": kind,
162
+ "type": type,
163
+ "codec": codec,
164
+ "container": container,
165
+ "width": width,
166
+ "height": height,
167
+ "orientation": orientation,
168
+ "rotation": rotation,
169
+ "transparency": transparency,
170
+ "animated": animated,
171
+ "frames": frames,
172
+ "duration": duration,
173
+ "fps": fps,
174
+ "filesize": filesize,
175
+ "bitrate": bitrate,
176
+ "language": language,
177
+ "label": label,
178
+ "ref": ref,
179
+ "folder": folder,
180
+ "filename": filename,
181
+ "url": url,
182
+ "placeholder": placeholder,
183
+ "background": background,
184
+ "metadata": metadata,
185
+ "original": original,
186
+ "created_by": created_by,
187
+ "created": created,
188
+ "updated": updated,
189
+ "status": status
190
+ }.reject do |_k, v|
191
+ v == OMIT
192
+ end
193
+ end
194
+
195
+ # Deserialize a JSON object to an instance of File
196
+ #
197
+ # @param json_object [String]
198
+ # @return [Ittybit::File]
199
+ def self.from_json(json_object:)
200
+ struct = JSON.parse(json_object, object_class: OpenStruct)
201
+ parsed_json = JSON.parse(json_object)
202
+ id = parsed_json["id"]
203
+ media_id = parsed_json["media_id"]
204
+ object = parsed_json["object"]
205
+ kind = parsed_json["kind"]
206
+ type = parsed_json["type"]
207
+ codec = parsed_json["codec"]
208
+ container = parsed_json["container"]
209
+ width = parsed_json["width"]
210
+ height = parsed_json["height"]
211
+ orientation = parsed_json["orientation"]
212
+ rotation = parsed_json["rotation"]
213
+ transparency = parsed_json["transparency"]
214
+ animated = parsed_json["animated"]
215
+ frames = parsed_json["frames"]
216
+ duration = parsed_json["duration"]
217
+ fps = parsed_json["fps"]
218
+ filesize = parsed_json["filesize"]
219
+ bitrate = parsed_json["bitrate"]
220
+ language = parsed_json["language"]
221
+ label = parsed_json["label"]
222
+ ref = parsed_json["ref"]
223
+ folder = parsed_json["folder"]
224
+ filename = parsed_json["filename"]
225
+ url = parsed_json["url"]
226
+ placeholder = parsed_json["placeholder"]
227
+ background = parsed_json["background"]
228
+ metadata = parsed_json["metadata"]
229
+ original = parsed_json["original"]
230
+ created_by = parsed_json["created_by"]
231
+ created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
232
+ updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
233
+ status = parsed_json["status"]
234
+ new(
235
+ id: id,
236
+ media_id: media_id,
237
+ object: object,
238
+ kind: kind,
239
+ type: type,
240
+ codec: codec,
241
+ container: container,
242
+ width: width,
243
+ height: height,
244
+ orientation: orientation,
245
+ rotation: rotation,
246
+ transparency: transparency,
247
+ animated: animated,
248
+ frames: frames,
249
+ duration: duration,
250
+ fps: fps,
251
+ filesize: filesize,
252
+ bitrate: bitrate,
253
+ language: language,
254
+ label: label,
255
+ ref: ref,
256
+ folder: folder,
257
+ filename: filename,
258
+ url: url,
259
+ placeholder: placeholder,
260
+ background: background,
261
+ metadata: metadata,
262
+ original: original,
263
+ created_by: created_by,
264
+ created: created,
265
+ updated: updated,
266
+ status: status,
267
+ additional_properties: struct
268
+ )
269
+ end
270
+
271
+ # Serialize an instance of File to a JSON object
272
+ #
273
+ # @return [String]
274
+ def to_json(*_args)
275
+ @_field_set&.to_json
276
+ end
277
+
278
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
279
+ # hash and check each fields type against the current object's property
280
+ # definitions.
281
+ #
282
+ # @param obj [Object]
283
+ # @return [Void]
284
+ def self.validate_raw(obj:)
285
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
286
+ obj.media_id.is_a?(String) != false || raise("Passed value for field obj.media_id is not the expected type, validation failed.")
287
+ obj.object.is_a?(Ittybit::FileObject) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
288
+ obj.kind.is_a?(Ittybit::FileKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
289
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
290
+ obj.codec&.is_a?(String) != false || raise("Passed value for field obj.codec is not the expected type, validation failed.")
291
+ obj.container&.is_a?(String) != false || raise("Passed value for field obj.container is not the expected type, validation failed.")
292
+ obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.")
293
+ obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.")
294
+ obj.orientation&.is_a?(String) != false || raise("Passed value for field obj.orientation is not the expected type, validation failed.")
295
+ obj.rotation&.is_a?(Float) != false || raise("Passed value for field obj.rotation is not the expected type, validation failed.")
296
+ obj.transparency&.is_a?(Boolean) != false || raise("Passed value for field obj.transparency is not the expected type, validation failed.")
297
+ obj.animated&.is_a?(Boolean) != false || raise("Passed value for field obj.animated is not the expected type, validation failed.")
298
+ obj.frames&.is_a?(Integer) != false || raise("Passed value for field obj.frames is not the expected type, validation failed.")
299
+ obj.duration&.is_a?(Float) != false || raise("Passed value for field obj.duration is not the expected type, validation failed.")
300
+ obj.fps&.is_a?(Float) != false || raise("Passed value for field obj.fps is not the expected type, validation failed.")
301
+ obj.filesize.is_a?(Integer) != false || raise("Passed value for field obj.filesize is not the expected type, validation failed.")
302
+ obj.bitrate&.is_a?(Integer) != false || raise("Passed value for field obj.bitrate is not the expected type, validation failed.")
303
+ obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
304
+ obj.label&.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
305
+ obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.")
306
+ obj.folder&.is_a?(String) != false || raise("Passed value for field obj.folder is not the expected type, validation failed.")
307
+ obj.filename&.is_a?(String) != false || raise("Passed value for field obj.filename is not the expected type, validation failed.")
308
+ obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
309
+ obj.placeholder&.is_a?(String) != false || raise("Passed value for field obj.placeholder is not the expected type, validation failed.")
310
+ obj.background&.is_a?(String) != false || raise("Passed value for field obj.background is not the expected type, validation failed.")
311
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
312
+ obj.original&.is_a?(Boolean) != false || raise("Passed value for field obj.original is not the expected type, validation failed.")
313
+ obj.created_by&.is_a?(String) != false || raise("Passed value for field obj.created_by is not the expected type, validation failed.")
314
+ obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
315
+ obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
316
+ obj.status.is_a?(Ittybit::FileStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
317
+ end
318
+ end
319
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ittybit
4
+ # The general type of media.
5
+ class FileKind
6
+ VIDEO = "video"
7
+ IMAGE = "image"
8
+ AUDIO = "audio"
9
+ end
10
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "meta_list"
4
+ require_relative "file"
5
+ require_relative "links_list"
6
+ require "ostruct"
7
+ require "json"
8
+
9
+ module Ittybit
10
+ class FileListResponse
11
+ # @return [Ittybit::MetaList]
12
+ attr_reader :meta
13
+ # @return [Array<Ittybit::File>]
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::File>]
27
+ # @param links [Ittybit::LinksList]
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [Ittybit::FileListResponse]
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 FileListResponse
41
+ #
42
+ # @param json_object [String]
43
+ # @return [Ittybit::FileListResponse]
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::File.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 FileListResponse 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,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ittybit
4
+ # Object type
5
+ class FileObject
6
+ SOURCE = "source"
7
+ TRACK = "track"
8
+ INTELLIGENCE = "intelligence"
9
+ end
10
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "meta"
4
+ require_relative "file"
5
+ require_relative "links"
6
+ require "ostruct"
7
+ require "json"
8
+
9
+ module Ittybit
10
+ class FileResponse
11
+ # @return [Ittybit::META]
12
+ attr_reader :meta
13
+ # @return [Ittybit::File]
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::File]
27
+ # @param links [Ittybit::Links]
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [Ittybit::FileResponse]
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 FileResponse
41
+ #
42
+ # @param json_object [String]
43
+ # @return [Ittybit::FileResponse]
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::File.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 FileResponse 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::File.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,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ittybit
4
+ # Processing status of the file.
5
+ class FileStatus
6
+ WAITING = "waiting"
7
+ PROCESSING = "processing"
8
+ READY = "ready"
9
+ FAILED = "failed"
10
+ end
11
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Ittybit
7
+ class Links
8
+ # @return [String] The absolute URL of the current request, potentially including query parameters.
9
+ attr_reader :self_
10
+ # @return [String] URL for the parent resource.
11
+ attr_reader :parent
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 self_ [String] The absolute URL of the current request, potentially including query parameters.
21
+ # @param parent [String] URL for the parent resource.
22
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
+ # @return [Ittybit::Links]
24
+ def initialize(self_: OMIT, parent: OMIT, additional_properties: nil)
25
+ @self_ = self_ if self_ != OMIT
26
+ @parent = parent if parent != OMIT
27
+ @additional_properties = additional_properties
28
+ @_field_set = { "self": self_, "parent": parent }.reject do |_k, v|
29
+ v == OMIT
30
+ end
31
+ end
32
+
33
+ # Deserialize a JSON object to an instance of Links
34
+ #
35
+ # @param json_object [String]
36
+ # @return [Ittybit::Links]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ parsed_json = JSON.parse(json_object)
40
+ self_ = parsed_json["self"]
41
+ parent = parsed_json["parent"]
42
+ new(
43
+ self_: self_,
44
+ parent: parent,
45
+ additional_properties: struct
46
+ )
47
+ end
48
+
49
+ # Serialize an instance of Links 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.self_&.is_a?(String) != false || raise("Passed value for field obj.self_ is not the expected type, validation failed.")
64
+ obj.parent&.is_a?(String) != false || raise("Passed value for field obj.parent is not the expected type, validation failed.")
65
+ end
66
+ end
67
+ end