ittybit 0.7.5.2 → 0.7.6

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ittybit/automations/client.rb +14 -6
  3. data/lib/ittybit/files/client.rb +67 -77
  4. data/lib/ittybit/media/client.rb +78 -34
  5. data/lib/ittybit/signatures/client.rb +20 -24
  6. data/lib/ittybit/signatures/types/signatures_create_request_method.rb +0 -3
  7. data/lib/ittybit/types/automation.rb +17 -27
  8. data/lib/ittybit/types/automation_list_response.rb +15 -2
  9. data/lib/ittybit/types/automation_response.rb +15 -2
  10. data/lib/ittybit/types/automation_status.rb +0 -1
  11. data/lib/ittybit/types/automation_trigger.rb +11 -16
  12. data/lib/ittybit/types/{confirmation_response_data.rb → confirmation.rb} +11 -9
  13. data/lib/ittybit/types/confirmation_response.rb +20 -7
  14. data/lib/ittybit/types/file.rb +64 -68
  15. data/lib/ittybit/types/file_kind.rb +0 -1
  16. data/lib/ittybit/types/file_list_response.rb +15 -2
  17. data/lib/ittybit/types/file_object.rb +0 -1
  18. data/lib/ittybit/types/file_response.rb +15 -2
  19. data/lib/ittybit/types/file_status.rb +0 -1
  20. data/lib/ittybit/types/links.rb +4 -4
  21. data/lib/ittybit/types/links_list.rb +17 -32
  22. data/lib/ittybit/types/media.rb +34 -56
  23. data/lib/ittybit/types/media_kind.rb +0 -1
  24. data/lib/ittybit/types/media_list_response.rb +15 -2
  25. data/lib/ittybit/types/media_response.rb +15 -2
  26. data/lib/ittybit/types/media_source.rb +52 -53
  27. data/lib/ittybit/types/media_source_kind.rb +0 -1
  28. data/lib/ittybit/types/media_source_object.rb +0 -1
  29. data/lib/ittybit/types/media_source_orientation.rb +9 -0
  30. data/lib/ittybit/types/media_source_status.rb +0 -1
  31. data/lib/ittybit/types/meta_list.rb +40 -15
  32. data/lib/ittybit/types/meta_list_type.rb +8 -0
  33. data/lib/ittybit/types/signature.rb +14 -14
  34. data/lib/ittybit/types/signature_response.rb +15 -2
  35. data/lib/ittybit/types/task.rb +30 -50
  36. data/lib/ittybit/types/task_list_response.rb +15 -2
  37. data/lib/ittybit/types/task_response.rb +15 -2
  38. data/lib/ittybit/types/task_status.rb +0 -1
  39. data/lib/ittybit/types/task_summary.rb +20 -20
  40. data/lib/ittybit/types/task_summary_kind.rb +9 -13
  41. data/lib/ittybit/types/task_summary_status.rb +0 -1
  42. data/lib/ittybit/types/workflow_task_step.rb +61 -29
  43. data/lib/ittybit/types/workflow_task_step_kind.rb +9 -13
  44. data/lib/requests.rb +2 -2
  45. data/lib/types_export.rb +3 -6
  46. metadata +5 -8
  47. data/lib/ittybit/files/types/files_delete_response.rb +0 -89
  48. data/lib/ittybit/files/types/files_delete_response_data.rb +0 -60
  49. data/lib/ittybit/types/automation_trigger_conditions_item.rb +0 -65
  50. data/lib/ittybit/types/error_response.rb +0 -74
  51. data/lib/ittybit/types/media_urls.rb +0 -70
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd94f84a429123a0617b4f00a5bffd27d702caff501b14315b2003fa3bdf1dab
4
- data.tar.gz: 8fda5aa3693a6d3e4595337edfd2dd2c292d4d70cd535a00c7b72b6ce931a35b
3
+ metadata.gz: b244efadc944c3d3983943a53e62e0b553e21eb9e0717ff4a3ee1512f3879909
4
+ data.tar.gz: f3736a908e119ee1324f616e07af8f63e4fdd5f0ac4447b6440990ece8fd7629
5
5
  SHA512:
6
- metadata.gz: 68e625decf459f5b295630c5b4dac821959a45854d3349967550a296f781d84f516dceff5dd84e784072ee36a19731161566ddd5ce6a76a33bb02568eebc51b3
7
- data.tar.gz: 5e14eae95e7e3c0e5ec81935d3a4591872d134f05b3430bdec49e11f3b857bed16735a61e46b435b76629f9b2034bc4ed091993dbc93c117bf3c2fe62f507a00
6
+ metadata.gz: 50e7da1d6cfb20932674642060b296ac71aedc88cb7ff4fa821ce18775458168afb227792f3605b601dccd370b15943e136ddd7f2fed98fe70a900ead5b1215c
7
+ data.tar.gz: c3038600b9d3973c045e1a7efa2e789bb15ba17b3ea3e5cab7b7681798634eb7d5c4c9b822d417599c6e034ed8a5e28affa1c29ee3779974ec45c8f48720b097
@@ -126,12 +126,16 @@ module Ittybit
126
126
  # * :conditions (Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>)
127
127
  # @param workflow [Array<Hash>] The updated sequence of tasks for the automation.Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
128
128
  # * :kind (Ittybit::WorkflowTaskStepKind)
129
- # * :label (String)
129
+ # * :ref (String)
130
130
  # * :format (String)
131
+ # * :start (Float)
132
+ # * :end_ (Float)
131
133
  # * :width (Integer)
132
134
  # * :height (Integer)
133
- # * :resize (String)
135
+ # * :fit (String)
136
+ # * :background (String)
134
137
  # * :quality (Integer)
138
+ # * :next_ (Array<Object>)
135
139
  # @param request_options [Ittybit::RequestOptions]
136
140
  # @return [Ittybit::AutomationResponse]
137
141
  # @example
@@ -144,7 +148,7 @@ module Ittybit
144
148
  # id: "id",
145
149
  # name: "Updated Transcoder Example",
146
150
  # trigger: { event: "upload.completed", conditions: [{ prop: "file.type", value: "image/*" }] },
147
- # workflow: [{ kind: IMAGE, label: "archive_image", format: "webp" }]
151
+ # workflow: [{ kind: IMAGE, format: "webp" }]
148
152
  # )
149
153
  def update(id:, name:, description: nil, trigger: nil, workflow: nil, request_options: nil)
150
154
  response = @request_client.conn.put do |req|
@@ -328,12 +332,16 @@ module Ittybit
328
332
  # * :conditions (Array<Ittybit::Automations::AutomationsUpdateRequestTriggerConditionsItem>)
329
333
  # @param workflow [Array<Hash>] The updated sequence of tasks for the automation.Request of type Array<Ittybit::WorkflowTaskStep>, as a Hash
330
334
  # * :kind (Ittybit::WorkflowTaskStepKind)
331
- # * :label (String)
335
+ # * :ref (String)
332
336
  # * :format (String)
337
+ # * :start (Float)
338
+ # * :end_ (Float)
333
339
  # * :width (Integer)
334
340
  # * :height (Integer)
335
- # * :resize (String)
341
+ # * :fit (String)
342
+ # * :background (String)
336
343
  # * :quality (Integer)
344
+ # * :next_ (Array<Object>)
337
345
  # @param request_options [Ittybit::RequestOptions]
338
346
  # @return [Ittybit::AutomationResponse]
339
347
  # @example
@@ -346,7 +354,7 @@ module Ittybit
346
354
  # id: "id",
347
355
  # name: "Updated Transcoder Example",
348
356
  # trigger: { event: "upload.completed", conditions: [{ prop: "file.type", value: "image/*" }] },
349
- # workflow: [{ kind: IMAGE, label: "archive_image", format: "webp" }]
357
+ # workflow: [{ kind: IMAGE, format: "webp" }]
350
358
  # )
351
359
  def update(id:, name:, description: nil, trigger: nil, workflow: nil, request_options: nil)
352
360
  Async do
@@ -3,7 +3,7 @@
3
3
  require_relative "../../requests"
4
4
  require_relative "../types/file_list_response"
5
5
  require_relative "../types/file_response"
6
- require_relative "types/files_delete_response"
6
+ require_relative "../types/confirmation_response"
7
7
  require "async"
8
8
 
9
9
  module Ittybit
@@ -18,9 +18,8 @@ module Ittybit
18
18
  end
19
19
 
20
20
  # Retrieves a paginated list of all files associated with the current project.
21
- # Files can be filtered using query parameters.
22
21
  #
23
- # @param limit [Integer] Items per page
22
+ # @param limit [Integer]
24
23
  # @param request_options [Ittybit::RequestOptions]
25
24
  # @return [Ittybit::FileListResponse]
26
25
  # @example
@@ -49,16 +48,14 @@ module Ittybit
49
48
  Ittybit::FileListResponse.from_json(json_object: response.body)
50
49
  end
51
50
 
52
- # Registers a file from a publicly accessible URL. The file will be ingested
53
- # asynchronously.
51
+ # Creates a new file from a publicly accessible or signed URL.
54
52
  #
55
- # @param url [String] The publicly accessible URL of the file to ingest.
56
- # @param filename [String] Optional desired filename. If not provided, it may be derived from the URL.
57
- # @param folder [String] Folder path (optional)
58
- # @param media_id [String] Optional existing media ID to associate the file with.
59
- # @param label [String] Optional label for the file.
60
- # @param metadata [Hash{String => Object}] Optional user-defined key-value metadata.
61
- # @param async [Boolean] Whether to process the ingestion asynchronously.
53
+ # @param url [String]
54
+ # @param media_id [String]
55
+ # @param folder [String]
56
+ # @param filename [String]
57
+ # @param ref [String]
58
+ # @param metadata [Hash{String => Object}]
62
59
  # @param request_options [Ittybit::RequestOptions]
63
60
  # @return [Ittybit::FileResponse]
64
61
  # @example
@@ -68,13 +65,12 @@ module Ittybit
68
65
  # token: "YOUR_AUTH_TOKEN"
69
66
  # )
70
67
  # api.files.create(
71
- # url: "https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
72
- # filename: "bunny.mp4",
73
- # folder: "examples/cartoons",
74
- # metadata: { "credit": "gtv-videos-bucket" }
68
+ # url: "https://ittyb.it/sample.mp4",
69
+ # folder: "ittybit/samples",
70
+ # filename: "video.mp4",
71
+ # metadata: { "customKey2": "a different custom value" }
75
72
  # )
76
- def create(url:, filename: nil, folder: nil, media_id: nil, label: nil, metadata: nil, async: nil,
77
- request_options: nil)
73
+ def create(url:, media_id: nil, folder: nil, filename: nil, ref: nil, metadata: nil, request_options: nil)
78
74
  response = @request_client.conn.post do |req|
79
75
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
80
76
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
@@ -90,20 +86,18 @@ module Ittybit
90
86
  req.body = {
91
87
  **(request_options&.additional_body_parameters || {}),
92
88
  url: url,
93
- filename: filename,
94
- folder: folder,
95
89
  media_id: media_id,
96
- label: label,
97
- metadata: metadata,
98
- async: async
90
+ folder: folder,
91
+ filename: filename,
92
+ ref: ref,
93
+ metadata: metadata
99
94
  }.compact
100
95
  req.url "#{@request_client.get_url(request_options: request_options)}/files"
101
96
  end
102
97
  Ittybit::FileResponse.from_json(json_object: response.body)
103
98
  end
104
99
 
105
- # Retrieves detailed information about a specific file identified by its unique
106
- # ID, including its metadata, media associations, and technical properties.
100
+ # Retrieve the file object for a file with the given ID.
107
101
  #
108
102
  # @param id [String]
109
103
  # @param request_options [Ittybit::RequestOptions]
@@ -137,11 +131,10 @@ module Ittybit
137
131
  end
138
132
 
139
133
  # Permanently removes a file from the system. This action cannot be undone.
140
- # Associated media entries may still reference this file ID.
141
134
  #
142
135
  # @param id [String]
143
136
  # @param request_options [Ittybit::RequestOptions]
144
- # @return [Ittybit::Files::FilesDeleteResponse]
137
+ # @return [Ittybit::ConfirmationResponse]
145
138
  # @example
146
139
  # api = Ittybit::Client.new(
147
140
  # base_url: "https://api.example.com",
@@ -167,17 +160,17 @@ module Ittybit
167
160
  end
168
161
  req.url "#{@request_client.get_url(request_options: request_options)}/files/#{id}"
169
162
  end
170
- Ittybit::Files::FilesDeleteResponse.from_json(json_object: response.body)
163
+ Ittybit::ConfirmationResponse.from_json(json_object: response.body)
171
164
  end
172
165
 
173
- # Updates metadata, filename, or folder properties of an existing file. Only the
174
- # specified fields will be updated.
166
+ # Update a file's `filename`, `folder`, `ref`, or `metadata`. Only the specified
167
+ # fields will be updated.
175
168
  #
176
169
  # @param id [String]
177
- # @param metadata [Hash{String => Object}] An object containing key-value pairs to set or update. Set a key to null to
178
- # remove it.
179
- # @param filename [String] New filename for the file.
180
- # @param folder [String] New folder path for the file.
170
+ # @param folder [String]
171
+ # @param filename [String]
172
+ # @param ref [String]
173
+ # @param metadata [Hash{String => Object}]
181
174
  # @param request_options [Ittybit::RequestOptions]
182
175
  # @return [Ittybit::FileResponse]
183
176
  # @example
@@ -188,10 +181,11 @@ module Ittybit
188
181
  # )
189
182
  # api.files.update(
190
183
  # id: "id",
191
- # filename: "final_approved_video.mp4",
192
- # folder: "archive/2024"
184
+ # folder: "updated/folder",
185
+ # filename: "new_filename.mp4",
186
+ # metadata: { "customKey2": "a different custom value" }
193
187
  # )
194
- def update(id:, metadata: nil, filename: nil, folder: nil, request_options: nil)
188
+ def update(id:, folder: nil, filename: nil, ref: nil, metadata: nil, request_options: nil)
195
189
  response = @request_client.conn.patch do |req|
196
190
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
197
191
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
@@ -206,9 +200,10 @@ module Ittybit
206
200
  end
207
201
  req.body = {
208
202
  **(request_options&.additional_body_parameters || {}),
209
- metadata: metadata,
203
+ folder: folder,
210
204
  filename: filename,
211
- folder: folder
205
+ ref: ref,
206
+ metadata: metadata
212
207
  }.compact
213
208
  req.url "#{@request_client.get_url(request_options: request_options)}/files/#{id}"
214
209
  end
@@ -227,9 +222,8 @@ module Ittybit
227
222
  end
228
223
 
229
224
  # Retrieves a paginated list of all files associated with the current project.
230
- # Files can be filtered using query parameters.
231
225
  #
232
- # @param limit [Integer] Items per page
226
+ # @param limit [Integer]
233
227
  # @param request_options [Ittybit::RequestOptions]
234
228
  # @return [Ittybit::FileListResponse]
235
229
  # @example
@@ -260,16 +254,14 @@ module Ittybit
260
254
  end
261
255
  end
262
256
 
263
- # Registers a file from a publicly accessible URL. The file will be ingested
264
- # asynchronously.
257
+ # Creates a new file from a publicly accessible or signed URL.
265
258
  #
266
- # @param url [String] The publicly accessible URL of the file to ingest.
267
- # @param filename [String] Optional desired filename. If not provided, it may be derived from the URL.
268
- # @param folder [String] Folder path (optional)
269
- # @param media_id [String] Optional existing media ID to associate the file with.
270
- # @param label [String] Optional label for the file.
271
- # @param metadata [Hash{String => Object}] Optional user-defined key-value metadata.
272
- # @param async [Boolean] Whether to process the ingestion asynchronously.
259
+ # @param url [String]
260
+ # @param media_id [String]
261
+ # @param folder [String]
262
+ # @param filename [String]
263
+ # @param ref [String]
264
+ # @param metadata [Hash{String => Object}]
273
265
  # @param request_options [Ittybit::RequestOptions]
274
266
  # @return [Ittybit::FileResponse]
275
267
  # @example
@@ -279,13 +271,12 @@ module Ittybit
279
271
  # token: "YOUR_AUTH_TOKEN"
280
272
  # )
281
273
  # api.files.create(
282
- # url: "https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
283
- # filename: "bunny.mp4",
284
- # folder: "examples/cartoons",
285
- # metadata: { "credit": "gtv-videos-bucket" }
274
+ # url: "https://ittyb.it/sample.mp4",
275
+ # folder: "ittybit/samples",
276
+ # filename: "video.mp4",
277
+ # metadata: { "customKey2": "a different custom value" }
286
278
  # )
287
- def create(url:, filename: nil, folder: nil, media_id: nil, label: nil, metadata: nil, async: nil,
288
- request_options: nil)
279
+ def create(url:, media_id: nil, folder: nil, filename: nil, ref: nil, metadata: nil, request_options: nil)
289
280
  Async do
290
281
  response = @request_client.conn.post do |req|
291
282
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -302,12 +293,11 @@ module Ittybit
302
293
  req.body = {
303
294
  **(request_options&.additional_body_parameters || {}),
304
295
  url: url,
305
- filename: filename,
306
- folder: folder,
307
296
  media_id: media_id,
308
- label: label,
309
- metadata: metadata,
310
- async: async
297
+ folder: folder,
298
+ filename: filename,
299
+ ref: ref,
300
+ metadata: metadata
311
301
  }.compact
312
302
  req.url "#{@request_client.get_url(request_options: request_options)}/files"
313
303
  end
@@ -315,8 +305,7 @@ module Ittybit
315
305
  end
316
306
  end
317
307
 
318
- # Retrieves detailed information about a specific file identified by its unique
319
- # ID, including its metadata, media associations, and technical properties.
308
+ # Retrieve the file object for a file with the given ID.
320
309
  #
321
310
  # @param id [String]
322
311
  # @param request_options [Ittybit::RequestOptions]
@@ -352,11 +341,10 @@ module Ittybit
352
341
  end
353
342
 
354
343
  # Permanently removes a file from the system. This action cannot be undone.
355
- # Associated media entries may still reference this file ID.
356
344
  #
357
345
  # @param id [String]
358
346
  # @param request_options [Ittybit::RequestOptions]
359
- # @return [Ittybit::Files::FilesDeleteResponse]
347
+ # @return [Ittybit::ConfirmationResponse]
360
348
  # @example
361
349
  # api = Ittybit::Client.new(
362
350
  # base_url: "https://api.example.com",
@@ -383,18 +371,18 @@ module Ittybit
383
371
  end
384
372
  req.url "#{@request_client.get_url(request_options: request_options)}/files/#{id}"
385
373
  end
386
- Ittybit::Files::FilesDeleteResponse.from_json(json_object: response.body)
374
+ Ittybit::ConfirmationResponse.from_json(json_object: response.body)
387
375
  end
388
376
  end
389
377
 
390
- # Updates metadata, filename, or folder properties of an existing file. Only the
391
- # specified fields will be updated.
378
+ # Update a file's `filename`, `folder`, `ref`, or `metadata`. Only the specified
379
+ # fields will be updated.
392
380
  #
393
381
  # @param id [String]
394
- # @param metadata [Hash{String => Object}] An object containing key-value pairs to set or update. Set a key to null to
395
- # remove it.
396
- # @param filename [String] New filename for the file.
397
- # @param folder [String] New folder path for the file.
382
+ # @param folder [String]
383
+ # @param filename [String]
384
+ # @param ref [String]
385
+ # @param metadata [Hash{String => Object}]
398
386
  # @param request_options [Ittybit::RequestOptions]
399
387
  # @return [Ittybit::FileResponse]
400
388
  # @example
@@ -405,10 +393,11 @@ module Ittybit
405
393
  # )
406
394
  # api.files.update(
407
395
  # id: "id",
408
- # filename: "final_approved_video.mp4",
409
- # folder: "archive/2024"
396
+ # folder: "updated/folder",
397
+ # filename: "new_filename.mp4",
398
+ # metadata: { "customKey2": "a different custom value" }
410
399
  # )
411
- def update(id:, metadata: nil, filename: nil, folder: nil, request_options: nil)
400
+ def update(id:, folder: nil, filename: nil, ref: nil, metadata: nil, request_options: nil)
412
401
  Async do
413
402
  response = @request_client.conn.patch do |req|
414
403
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -424,9 +413,10 @@ module Ittybit
424
413
  end
425
414
  req.body = {
426
415
  **(request_options&.additional_body_parameters || {}),
427
- metadata: metadata,
416
+ folder: folder,
428
417
  filename: filename,
429
- folder: folder
418
+ ref: ref,
419
+ metadata: metadata
430
420
  }.compact
431
421
  req.url "#{@request_client.get_url(request_options: request_options)}/files/#{id}"
432
422
  end
@@ -17,9 +17,9 @@ module Ittybit
17
17
  @request_client = request_client
18
18
  end
19
19
 
20
- # Retrieves a list of all media for the current project
20
+ # Retrieves a paginated list of all media for the current project
21
21
  #
22
- # @param limit [Integer] Number of media items to return per page.
22
+ # @param limit [Integer]
23
23
  # @param request_options [Ittybit::RequestOptions]
24
24
  # @return [Ittybit::MediaListResponse]
25
25
  # @example
@@ -48,10 +48,11 @@ module Ittybit
48
48
  Ittybit::MediaListResponse.from_json(json_object: response.body)
49
49
  end
50
50
 
51
- # Creates a new media item from a URL or as an empty placeholder
51
+ # Creates a new media item.
52
52
  #
53
- # @param title [String] Title for the media
54
- # @param metadata [Hash{String => Object}] Additional metadata for the media
53
+ # @param title [String]
54
+ # @param alt [String]
55
+ # @param metadata [Hash{String => Object}]
55
56
  # @param request_options [Ittybit::RequestOptions]
56
57
  # @return [Ittybit::MediaResponse]
57
58
  # @example
@@ -60,8 +61,12 @@ module Ittybit
60
61
  # environment: Ittybit::Environment::DEFAULT,
61
62
  # token: "YOUR_AUTH_TOKEN"
62
63
  # )
63
- # api.media.create(metadata: { "credit": "gtv-videos-bucket" })
64
- def create(title: nil, metadata: nil, request_options: nil)
64
+ # api.media.create(
65
+ # title: "My Video Example",
66
+ # alt: "An example video used to demonstrate the ittybit API",
67
+ # metadata: { "customKey2": "a different custom value" }
68
+ # )
69
+ def create(title: nil, alt: nil, metadata: nil, request_options: nil)
65
70
  response = @request_client.conn.post do |req|
66
71
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
67
72
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
@@ -74,13 +79,18 @@ module Ittybit
74
79
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
75
80
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
76
81
  end
77
- req.body = { **(request_options&.additional_body_parameters || {}), title: title, metadata: metadata }.compact
82
+ req.body = {
83
+ **(request_options&.additional_body_parameters || {}),
84
+ title: title,
85
+ alt: alt,
86
+ metadata: metadata
87
+ }.compact
78
88
  req.url "#{@request_client.get_url(request_options: request_options)}/media"
79
89
  end
80
90
  Ittybit::MediaResponse.from_json(json_object: response.body)
81
91
  end
82
92
 
83
- # Retrieves a specific media item by its ID
93
+ # Retrieves the media object for a media with the given ID.
84
94
  #
85
95
  # @param id [String]
86
96
  # @param request_options [Ittybit::RequestOptions]
@@ -113,7 +123,8 @@ module Ittybit
113
123
  Ittybit::MediaResponse.from_json(json_object: response.body)
114
124
  end
115
125
 
116
- # Deletes a specific media item by its ID
126
+ # Permanently removes a media object from the system. This action cannot be
127
+ # undone.
117
128
  #
118
129
  # @param id [String]
119
130
  # @param request_options [Ittybit::RequestOptions]
@@ -146,12 +157,13 @@ module Ittybit
146
157
  Ittybit::ConfirmationResponse.from_json(json_object: response.body)
147
158
  end
148
159
 
149
- # Updates specific fields of a media item by its ID. Only the fields provided in
150
- # the request body will be updated.
160
+ # Updates a media object's `title`, `alt`, or `metadata`. Only the specified
161
+ # fields will be updated.
151
162
  #
152
163
  # @param id [String]
153
- # @param title [String] New title for the media item.
154
- # @param metadata [Hash{String => Object}] New metadata object for the media item. This will replace the existing metadata.
164
+ # @param title [String]
165
+ # @param alt [String]
166
+ # @param metadata [Hash{String => Object}]
155
167
  # @param request_options [Ittybit::RequestOptions]
156
168
  # @return [Ittybit::MediaResponse]
157
169
  # @example
@@ -160,8 +172,13 @@ module Ittybit
160
172
  # environment: Ittybit::Environment::DEFAULT,
161
173
  # token: "YOUR_AUTH_TOKEN"
162
174
  # )
163
- # api.media.update(id: "id")
164
- def update(id:, title: nil, metadata: nil, request_options: nil)
175
+ # api.media.update(
176
+ # id: "id",
177
+ # title: "Updated Video Example",
178
+ # alt: "An updated example video used to demonstrate the ittybit API",
179
+ # metadata: { "customKey2": "a different custom value" }
180
+ # )
181
+ def update(id:, title: nil, alt: nil, metadata: nil, request_options: nil)
165
182
  response = @request_client.conn.patch do |req|
166
183
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
167
184
  req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
@@ -174,7 +191,12 @@ module Ittybit
174
191
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
175
192
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
176
193
  end
177
- req.body = { **(request_options&.additional_body_parameters || {}), title: title, metadata: metadata }.compact
194
+ req.body = {
195
+ **(request_options&.additional_body_parameters || {}),
196
+ title: title,
197
+ alt: alt,
198
+ metadata: metadata
199
+ }.compact
178
200
  req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
179
201
  end
180
202
  Ittybit::MediaResponse.from_json(json_object: response.body)
@@ -191,9 +213,9 @@ module Ittybit
191
213
  @request_client = request_client
192
214
  end
193
215
 
194
- # Retrieves a list of all media for the current project
216
+ # Retrieves a paginated list of all media for the current project
195
217
  #
196
- # @param limit [Integer] Number of media items to return per page.
218
+ # @param limit [Integer]
197
219
  # @param request_options [Ittybit::RequestOptions]
198
220
  # @return [Ittybit::MediaListResponse]
199
221
  # @example
@@ -224,10 +246,11 @@ module Ittybit
224
246
  end
225
247
  end
226
248
 
227
- # Creates a new media item from a URL or as an empty placeholder
249
+ # Creates a new media item.
228
250
  #
229
- # @param title [String] Title for the media
230
- # @param metadata [Hash{String => Object}] Additional metadata for the media
251
+ # @param title [String]
252
+ # @param alt [String]
253
+ # @param metadata [Hash{String => Object}]
231
254
  # @param request_options [Ittybit::RequestOptions]
232
255
  # @return [Ittybit::MediaResponse]
233
256
  # @example
@@ -236,8 +259,12 @@ module Ittybit
236
259
  # environment: Ittybit::Environment::DEFAULT,
237
260
  # token: "YOUR_AUTH_TOKEN"
238
261
  # )
239
- # api.media.create(metadata: { "credit": "gtv-videos-bucket" })
240
- def create(title: nil, metadata: nil, request_options: nil)
262
+ # api.media.create(
263
+ # title: "My Video Example",
264
+ # alt: "An example video used to demonstrate the ittybit API",
265
+ # metadata: { "customKey2": "a different custom value" }
266
+ # )
267
+ def create(title: nil, alt: nil, metadata: nil, request_options: nil)
241
268
  Async do
242
269
  response = @request_client.conn.post do |req|
243
270
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -251,14 +278,19 @@ module Ittybit
251
278
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
252
279
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
253
280
  end
254
- req.body = { **(request_options&.additional_body_parameters || {}), title: title, metadata: metadata }.compact
281
+ req.body = {
282
+ **(request_options&.additional_body_parameters || {}),
283
+ title: title,
284
+ alt: alt,
285
+ metadata: metadata
286
+ }.compact
255
287
  req.url "#{@request_client.get_url(request_options: request_options)}/media"
256
288
  end
257
289
  Ittybit::MediaResponse.from_json(json_object: response.body)
258
290
  end
259
291
  end
260
292
 
261
- # Retrieves a specific media item by its ID
293
+ # Retrieves the media object for a media with the given ID.
262
294
  #
263
295
  # @param id [String]
264
296
  # @param request_options [Ittybit::RequestOptions]
@@ -293,7 +325,8 @@ module Ittybit
293
325
  end
294
326
  end
295
327
 
296
- # Deletes a specific media item by its ID
328
+ # Permanently removes a media object from the system. This action cannot be
329
+ # undone.
297
330
  #
298
331
  # @param id [String]
299
332
  # @param request_options [Ittybit::RequestOptions]
@@ -328,12 +361,13 @@ module Ittybit
328
361
  end
329
362
  end
330
363
 
331
- # Updates specific fields of a media item by its ID. Only the fields provided in
332
- # the request body will be updated.
364
+ # Updates a media object's `title`, `alt`, or `metadata`. Only the specified
365
+ # fields will be updated.
333
366
  #
334
367
  # @param id [String]
335
- # @param title [String] New title for the media item.
336
- # @param metadata [Hash{String => Object}] New metadata object for the media item. This will replace the existing metadata.
368
+ # @param title [String]
369
+ # @param alt [String]
370
+ # @param metadata [Hash{String => Object}]
337
371
  # @param request_options [Ittybit::RequestOptions]
338
372
  # @return [Ittybit::MediaResponse]
339
373
  # @example
@@ -342,8 +376,13 @@ module Ittybit
342
376
  # environment: Ittybit::Environment::DEFAULT,
343
377
  # token: "YOUR_AUTH_TOKEN"
344
378
  # )
345
- # api.media.update(id: "id")
346
- def update(id:, title: nil, metadata: nil, request_options: nil)
379
+ # api.media.update(
380
+ # id: "id",
381
+ # title: "Updated Video Example",
382
+ # alt: "An updated example video used to demonstrate the ittybit API",
383
+ # metadata: { "customKey2": "a different custom value" }
384
+ # )
385
+ def update(id:, title: nil, alt: nil, metadata: nil, request_options: nil)
347
386
  Async do
348
387
  response = @request_client.conn.patch do |req|
349
388
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -357,7 +396,12 @@ module Ittybit
357
396
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
358
397
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
359
398
  end
360
- req.body = { **(request_options&.additional_body_parameters || {}), title: title, metadata: metadata }.compact
399
+ req.body = {
400
+ **(request_options&.additional_body_parameters || {}),
401
+ title: title,
402
+ alt: alt,
403
+ metadata: metadata
404
+ }.compact
361
405
  req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
362
406
  end
363
407
  Ittybit::MediaResponse.from_json(json_object: response.body)