ittybit 0.8.14 → 1.0.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.
- checksums.yaml +4 -4
- data/lib/ittybit/automations/client.rb +80 -60
- data/lib/ittybit/automations/types/automations_create_request_workflow_item.rb +81 -0
- data/lib/ittybit/automations/types/automations_create_request_workflow_item_kind.rb +20 -0
- data/lib/ittybit/automations/types/automations_create_request_workflow_item_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_create_response.rb +133 -0
- data/lib/ittybit/automations/types/automations_create_response_status.rb +10 -0
- data/lib/ittybit/automations/types/automations_create_response_trigger.rb +67 -0
- data/lib/ittybit/automations/types/automations_create_response_workflow_item.rb +61 -0
- data/lib/ittybit/automations/types/automations_create_response_workflow_item_conditions.rb +86 -0
- data/lib/ittybit/automations/types/automations_create_response_workflow_item_conditions_conditions_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_create_response_workflow_item_conditions_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_create_response_workflow_item_ref.rb +83 -0
- data/lib/ittybit/automations/types/automations_create_response_workflow_item_ref_kind.rb +20 -0
- data/lib/ittybit/automations/types/automations_create_response_workflow_item_ref_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_delete_response.rb +59 -0
- data/lib/ittybit/automations/types/automations_get_response.rb +133 -0
- data/lib/ittybit/automations/types/automations_get_response_status.rb +10 -0
- data/lib/ittybit/automations/types/automations_get_response_trigger.rb +67 -0
- data/lib/ittybit/automations/types/automations_get_response_workflow_item.rb +60 -0
- data/lib/ittybit/automations/types/automations_get_response_workflow_item_conditions.rb +86 -0
- data/lib/ittybit/automations/types/automations_get_response_workflow_item_conditions_conditions_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_get_response_workflow_item_conditions_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_get_response_workflow_item_ref.rb +82 -0
- data/lib/ittybit/automations/types/automations_get_response_workflow_item_ref_kind.rb +20 -0
- data/lib/ittybit/automations/types/automations_get_response_workflow_item_ref_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_list_response_item.rb +133 -0
- data/lib/ittybit/automations/types/automations_list_response_item_status.rb +10 -0
- data/lib/ittybit/automations/types/automations_list_response_item_trigger.rb +67 -0
- data/lib/ittybit/automations/types/automations_list_response_item_workflow_item.rb +61 -0
- data/lib/ittybit/automations/types/automations_list_response_item_workflow_item_conditions.rb +86 -0
- data/lib/ittybit/automations/types/automations_list_response_item_workflow_item_conditions_conditions_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_list_response_item_workflow_item_conditions_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_list_response_item_workflow_item_ref.rb +83 -0
- data/lib/ittybit/automations/types/automations_list_response_item_workflow_item_ref_kind.rb +20 -0
- data/lib/ittybit/automations/types/automations_list_response_item_workflow_item_ref_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_update_request_workflow_item.rb +81 -0
- data/lib/ittybit/automations/types/automations_update_request_workflow_item_kind.rb +20 -0
- data/lib/ittybit/automations/types/automations_update_request_workflow_item_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_update_response.rb +133 -0
- data/lib/ittybit/automations/types/automations_update_response_status.rb +10 -0
- data/lib/ittybit/automations/types/automations_update_response_trigger.rb +67 -0
- data/lib/ittybit/automations/types/automations_update_response_workflow_item.rb +61 -0
- data/lib/ittybit/automations/types/automations_update_response_workflow_item_conditions.rb +86 -0
- data/lib/ittybit/automations/types/automations_update_response_workflow_item_conditions_conditions_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_update_response_workflow_item_conditions_next_item.rb +71 -0
- data/lib/ittybit/automations/types/automations_update_response_workflow_item_ref.rb +83 -0
- data/lib/ittybit/automations/types/automations_update_response_workflow_item_ref_kind.rb +20 -0
- data/lib/ittybit/automations/types/automations_update_response_workflow_item_ref_next_item.rb +71 -0
- data/lib/ittybit/files/client.rb +76 -55
- data/lib/ittybit/files/types/files_create_response.rb +317 -0
- data/lib/ittybit/files/types/files_create_response_kind.rb +11 -0
- data/lib/ittybit/files/types/files_create_response_object.rb +11 -0
- data/lib/ittybit/files/types/files_create_response_status.rb +12 -0
- data/lib/ittybit/files/types/files_delete_response.rb +59 -0
- data/lib/ittybit/files/types/files_get_response.rb +317 -0
- data/lib/ittybit/files/types/files_get_response_kind.rb +11 -0
- data/lib/ittybit/files/types/files_get_response_object.rb +11 -0
- data/lib/ittybit/files/types/files_get_response_status.rb +12 -0
- data/lib/ittybit/files/types/files_list_response_item.rb +317 -0
- data/lib/ittybit/files/types/files_list_response_item_kind.rb +11 -0
- data/lib/ittybit/files/types/files_list_response_item_object.rb +11 -0
- data/lib/ittybit/files/types/files_list_response_item_status.rb +12 -0
- data/lib/ittybit/files/types/files_update_response.rb +317 -0
- data/lib/ittybit/files/types/files_update_response_kind.rb +11 -0
- data/lib/ittybit/files/types/files_update_response_object.rb +11 -0
- data/lib/ittybit/files/types/files_update_response_status.rb +12 -0
- data/lib/ittybit/media/client.rb +77 -56
- data/lib/ittybit/media/types/media_create_response.rb +175 -0
- data/lib/ittybit/media/types/media_create_response_files_item.rb +262 -0
- data/lib/ittybit/media/types/media_create_response_files_item_kind.rb +11 -0
- data/lib/ittybit/media/types/media_create_response_files_item_object.rb +11 -0
- data/lib/ittybit/media/types/media_create_response_files_item_orientation.rb +11 -0
- data/lib/ittybit/media/types/media_create_response_files_item_status.rb +12 -0
- data/lib/ittybit/media/types/media_create_response_kind.rb +11 -0
- data/lib/ittybit/media/types/media_delete_response.rb +59 -0
- data/lib/ittybit/media/types/media_get_response.rb +175 -0
- data/lib/ittybit/media/types/media_get_response_files_item.rb +262 -0
- data/lib/ittybit/media/types/media_get_response_files_item_kind.rb +11 -0
- data/lib/ittybit/media/types/media_get_response_files_item_object.rb +11 -0
- data/lib/ittybit/media/types/media_get_response_files_item_orientation.rb +11 -0
- data/lib/ittybit/media/types/media_get_response_files_item_status.rb +12 -0
- data/lib/ittybit/media/types/media_get_response_kind.rb +11 -0
- data/lib/ittybit/media/types/media_update_response.rb +175 -0
- data/lib/ittybit/media/types/media_update_response_files_item.rb +262 -0
- data/lib/ittybit/media/types/media_update_response_files_item_kind.rb +11 -0
- data/lib/ittybit/media/types/media_update_response_files_item_object.rb +11 -0
- data/lib/ittybit/media/types/media_update_response_files_item_orientation.rb +11 -0
- data/lib/ittybit/media/types/media_update_response_files_item_status.rb +12 -0
- data/lib/ittybit/media/types/media_update_response_kind.rb +11 -0
- data/lib/ittybit/signatures/client.rb +13 -11
- data/lib/ittybit/signatures/types/signatures_create_response.rb +112 -0
- data/lib/ittybit/tasks/client.rb +47 -99
- data/lib/ittybit/tasks/types/tasks_create_response.rb +186 -0
- data/lib/ittybit/tasks/types/tasks_create_response_kind.rb +23 -0
- data/lib/ittybit/tasks/types/tasks_create_response_results.rb +76 -0
- data/lib/ittybit/tasks/types/tasks_create_response_status.rb +16 -0
- data/lib/ittybit/tasks/types/tasks_get_response.rb +186 -0
- data/lib/ittybit/tasks/types/tasks_get_response_kind.rb +23 -0
- data/lib/ittybit/tasks/types/tasks_get_response_results.rb +76 -0
- data/lib/ittybit/tasks/types/tasks_get_response_status.rb +16 -0
- data/lib/ittybit/tasks/types/tasks_list_response_item.rb +186 -0
- data/lib/ittybit/tasks/types/tasks_list_response_item_kind.rb +23 -0
- data/lib/ittybit/tasks/types/tasks_list_response_item_results.rb +76 -0
- data/lib/ittybit/tasks/types/tasks_list_response_item_status.rb +16 -0
- data/lib/ittybit/types/automation_list_response.rb +2 -98
- data/lib/ittybit/types/automation_list_response_item.rb +131 -0
- data/lib/ittybit/types/automation_list_response_item_status.rb +8 -0
- data/lib/ittybit/types/automation_list_response_item_trigger.rb +65 -0
- data/lib/ittybit/types/automation_list_response_item_workflow_item.rb +57 -0
- data/lib/ittybit/types/automation_list_response_item_workflow_item_conditions.rb +84 -0
- data/lib/ittybit/types/automation_list_response_item_workflow_item_conditions_conditions_item.rb +69 -0
- data/lib/ittybit/types/automation_list_response_item_workflow_item_conditions_next_item.rb +69 -0
- data/lib/ittybit/types/automation_list_response_item_workflow_item_ref.rb +81 -0
- data/lib/ittybit/types/automation_list_response_item_workflow_item_ref_kind.rb +18 -0
- data/lib/ittybit/types/automation_list_response_item_workflow_item_ref_next_item.rb +69 -0
- data/lib/ittybit/types/automation_response.rb +77 -46
- data/lib/ittybit/types/automation_response_status.rb +8 -0
- data/lib/ittybit/types/automation_response_trigger.rb +65 -0
- data/lib/ittybit/types/automation_response_workflow_item.rb +54 -0
- data/lib/ittybit/types/automation_response_workflow_item_conditions.rb +84 -0
- data/lib/ittybit/types/automation_response_workflow_item_conditions_conditions_item.rb +69 -0
- data/lib/ittybit/types/automation_response_workflow_item_conditions_next_item.rb +69 -0
- data/lib/ittybit/types/automation_response_workflow_item_ref.rb +79 -0
- data/lib/ittybit/types/automation_response_workflow_item_ref_kind.rb +18 -0
- data/lib/ittybit/types/automation_response_workflow_item_ref_next_item.rb +69 -0
- data/lib/ittybit/types/automation_workflow_item.rb +8 -8
- data/lib/ittybit/types/automation_workflow_item_conditions.rb +82 -0
- data/lib/ittybit/types/automation_workflow_item_conditions_conditions_item.rb +69 -0
- data/lib/ittybit/types/automation_workflow_item_conditions_next_item.rb +69 -0
- data/lib/ittybit/types/automation_workflow_item_ref.rb +79 -0
- data/lib/ittybit/types/automation_workflow_item_ref_kind.rb +18 -0
- data/lib/ittybit/types/automation_workflow_item_ref_next_item.rb +67 -0
- data/lib/ittybit/types/confirmation_response.rb +9 -52
- data/lib/ittybit/types/created_by.rb +5 -0
- data/lib/ittybit/types/error.rb +1 -53
- data/lib/ittybit/types/file_list_response.rb +2 -98
- data/lib/ittybit/types/file_list_response_item.rb +315 -0
- data/lib/ittybit/types/file_list_response_item_kind.rb +9 -0
- data/lib/ittybit/types/file_list_response_item_object.rb +9 -0
- data/lib/ittybit/types/file_list_response_item_status.rb +10 -0
- data/lib/ittybit/types/file_response.rb +264 -49
- data/lib/ittybit/types/file_response_kind.rb +9 -0
- data/lib/ittybit/types/file_response_object.rb +9 -0
- data/lib/ittybit/types/file_response_status.rb +10 -0
- data/lib/ittybit/types/kind.rb +21 -0
- data/lib/ittybit/types/links.rb +1 -63
- data/lib/ittybit/types/media.rb +4 -4
- data/lib/ittybit/types/media_files_item.rb +260 -0
- data/lib/ittybit/types/media_files_item_kind.rb +9 -0
- data/lib/ittybit/types/media_files_item_object.rb +9 -0
- data/lib/ittybit/types/media_files_item_orientation.rb +9 -0
- data/lib/ittybit/types/media_files_item_status.rb +10 -0
- data/lib/ittybit/types/media_list_response.rb +2 -98
- data/lib/ittybit/types/media_list_response_item.rb +173 -0
- data/lib/ittybit/types/media_list_response_item_files_item.rb +260 -0
- data/lib/ittybit/types/media_list_response_item_files_item_kind.rb +9 -0
- data/lib/ittybit/types/media_list_response_item_files_item_object.rb +9 -0
- data/lib/ittybit/types/media_list_response_item_files_item_orientation.rb +9 -0
- data/lib/ittybit/types/media_list_response_item_files_item_status.rb +10 -0
- data/lib/ittybit/types/media_list_response_item_kind.rb +9 -0
- data/lib/ittybit/types/media_response.rb +121 -48
- data/lib/ittybit/types/media_response_files_item.rb +260 -0
- data/lib/ittybit/types/media_response_files_item_kind.rb +9 -0
- data/lib/ittybit/types/media_response_files_item_object.rb +9 -0
- data/lib/ittybit/types/media_response_files_item_orientation.rb +9 -0
- data/lib/ittybit/types/media_response_files_item_status.rb +10 -0
- data/lib/ittybit/types/media_response_kind.rb +9 -0
- data/lib/ittybit/types/parent_id.rb +5 -0
- data/lib/ittybit/types/progress.rb +5 -0
- data/lib/ittybit/types/signature_response.rb +59 -49
- data/lib/ittybit/types/status.rb +14 -0
- data/lib/ittybit/types/task_list_response.rb +2 -98
- data/lib/ittybit/types/task_list_response_item.rb +184 -0
- data/lib/ittybit/types/task_list_response_item_kind.rb +21 -0
- data/lib/ittybit/types/task_list_response_item_results.rb +74 -0
- data/lib/ittybit/types/task_list_response_item_status.rb +14 -0
- data/lib/ittybit/types/task_response.rb +128 -44
- data/lib/ittybit/types/task_response_kind.rb +21 -0
- data/lib/ittybit/types/task_response_results.rb +74 -0
- data/lib/ittybit/types/task_response_status.rb +14 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +168 -9
- metadata +163 -5
- data/lib/ittybit/types/links_list.rb +0 -88
- data/lib/ittybit/types/meta_list.rb +0 -128
- data/lib/ittybit/types/meta_list_type.rb +0 -8
data/lib/ittybit/media/client.rb
CHANGED
@@ -2,8 +2,11 @@
|
|
2
2
|
|
3
3
|
require_relative "../../requests"
|
4
4
|
require_relative "../types/media_list_response"
|
5
|
-
|
6
|
-
require_relative "
|
5
|
+
require "json"
|
6
|
+
require_relative "types/media_create_response"
|
7
|
+
require_relative "types/media_get_response"
|
8
|
+
require_relative "types/media_delete_response"
|
9
|
+
require_relative "types/media_update_response"
|
7
10
|
require "async"
|
8
11
|
|
9
12
|
module Ittybit
|
@@ -22,7 +25,7 @@ module Ittybit
|
|
22
25
|
# @param page [Integer]
|
23
26
|
# @param limit [Integer]
|
24
27
|
# @param request_options [Ittybit::RequestOptions]
|
25
|
-
# @return [Ittybit::
|
28
|
+
# @return [Ittybit::MEDIA_LIST_RESPONSE]
|
26
29
|
# @example
|
27
30
|
# api = Ittybit::Client.new(
|
28
31
|
# base_url: "https://api.example.com",
|
@@ -36,9 +39,10 @@ module Ittybit
|
|
36
39
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
37
40
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
38
41
|
req.headers = {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
**(req.headers || {}),
|
43
|
+
**@request_client.get_headers,
|
44
|
+
**(request_options&.additional_headers || {}),
|
45
|
+
"Accept-Version": "2025-08-20"
|
42
46
|
}.compact
|
43
47
|
req.params = { **(request_options&.additional_query_parameters || {}), "page": page, "limit": limit }.compact
|
44
48
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
@@ -46,7 +50,11 @@ module Ittybit
|
|
46
50
|
end
|
47
51
|
req.url "#{@request_client.get_url(request_options: request_options)}/media"
|
48
52
|
end
|
49
|
-
|
53
|
+
parsed_json = JSON.parse(response.body)
|
54
|
+
parsed_json&.map do |item|
|
55
|
+
item = item.to_json
|
56
|
+
Ittybit::MediaListResponseItem.from_json(json_object: item)
|
57
|
+
end
|
50
58
|
end
|
51
59
|
|
52
60
|
# Creates a new media item. See [Media Object](/docs/media) for more details.
|
@@ -55,7 +63,7 @@ module Ittybit
|
|
55
63
|
# @param alt [String]
|
56
64
|
# @param metadata [Hash{String => Object}]
|
57
65
|
# @param request_options [Ittybit::RequestOptions]
|
58
|
-
# @return [Ittybit::
|
66
|
+
# @return [Ittybit::Media::MediaCreateResponse]
|
59
67
|
# @example
|
60
68
|
# api = Ittybit::Client.new(
|
61
69
|
# base_url: "https://api.example.com",
|
@@ -65,7 +73,7 @@ module Ittybit
|
|
65
73
|
# api.media.create(
|
66
74
|
# title: "My Video Example",
|
67
75
|
# alt: "An example video used to demonstrate the ittybit API",
|
68
|
-
# metadata: { "
|
76
|
+
# metadata: { "customKey": "your custom value" }
|
69
77
|
# )
|
70
78
|
def create(title: nil, alt: nil, metadata: nil, request_options: nil)
|
71
79
|
response = @request_client.conn.post do |req|
|
@@ -73,9 +81,10 @@ module Ittybit
|
|
73
81
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
74
82
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
75
83
|
req.headers = {
|
76
|
-
|
77
|
-
|
78
|
-
|
84
|
+
**(req.headers || {}),
|
85
|
+
**@request_client.get_headers,
|
86
|
+
**(request_options&.additional_headers || {}),
|
87
|
+
"Accept-Version": "2025-08-20"
|
79
88
|
}.compact
|
80
89
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
81
90
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -88,14 +97,14 @@ module Ittybit
|
|
88
97
|
}.compact
|
89
98
|
req.url "#{@request_client.get_url(request_options: request_options)}/media"
|
90
99
|
end
|
91
|
-
Ittybit::
|
100
|
+
Ittybit::Media::MediaCreateResponse.from_json(json_object: response.body)
|
92
101
|
end
|
93
102
|
|
94
103
|
# Retrieves the media object for a media with the given ID.
|
95
104
|
#
|
96
105
|
# @param id [String]
|
97
106
|
# @param request_options [Ittybit::RequestOptions]
|
98
|
-
# @return [Ittybit::
|
107
|
+
# @return [Ittybit::Media::MediaGetResponse]
|
99
108
|
# @example
|
100
109
|
# api = Ittybit::Client.new(
|
101
110
|
# base_url: "https://api.example.com",
|
@@ -109,9 +118,10 @@ module Ittybit
|
|
109
118
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
110
119
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
111
120
|
req.headers = {
|
112
|
-
|
113
|
-
|
114
|
-
|
121
|
+
**(req.headers || {}),
|
122
|
+
**@request_client.get_headers,
|
123
|
+
**(request_options&.additional_headers || {}),
|
124
|
+
"Accept-Version": "2025-08-20"
|
115
125
|
}.compact
|
116
126
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
117
127
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -121,7 +131,7 @@ module Ittybit
|
|
121
131
|
end
|
122
132
|
req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
|
123
133
|
end
|
124
|
-
Ittybit::
|
134
|
+
Ittybit::Media::MediaGetResponse.from_json(json_object: response.body)
|
125
135
|
end
|
126
136
|
|
127
137
|
# Permanently removes a media object from the system. This action cannot be
|
@@ -129,7 +139,7 @@ module Ittybit
|
|
129
139
|
#
|
130
140
|
# @param id [String]
|
131
141
|
# @param request_options [Ittybit::RequestOptions]
|
132
|
-
# @return [Ittybit::
|
142
|
+
# @return [Ittybit::Media::MediaDeleteResponse]
|
133
143
|
# @example
|
134
144
|
# api = Ittybit::Client.new(
|
135
145
|
# base_url: "https://api.example.com",
|
@@ -143,9 +153,10 @@ module Ittybit
|
|
143
153
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
144
154
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
145
155
|
req.headers = {
|
146
|
-
|
147
|
-
|
148
|
-
|
156
|
+
**(req.headers || {}),
|
157
|
+
**@request_client.get_headers,
|
158
|
+
**(request_options&.additional_headers || {}),
|
159
|
+
"Accept-Version": "2025-08-20"
|
149
160
|
}.compact
|
150
161
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
151
162
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -155,7 +166,7 @@ module Ittybit
|
|
155
166
|
end
|
156
167
|
req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
|
157
168
|
end
|
158
|
-
Ittybit::
|
169
|
+
Ittybit::Media::MediaDeleteResponse.from_json(json_object: response.body)
|
159
170
|
end
|
160
171
|
|
161
172
|
# Updates a media object's `title`, `alt`, or `metadata`. Only the specified
|
@@ -166,7 +177,7 @@ module Ittybit
|
|
166
177
|
# @param alt [String]
|
167
178
|
# @param metadata [Hash{String => Object}]
|
168
179
|
# @param request_options [Ittybit::RequestOptions]
|
169
|
-
# @return [Ittybit::
|
180
|
+
# @return [Ittybit::Media::MediaUpdateResponse]
|
170
181
|
# @example
|
171
182
|
# api = Ittybit::Client.new(
|
172
183
|
# base_url: "https://api.example.com",
|
@@ -177,7 +188,7 @@ module Ittybit
|
|
177
188
|
# id: "med_abcdefgh1234",
|
178
189
|
# title: "Updated Video Example",
|
179
190
|
# alt: "An updated example video used to demonstrate the ittybit API",
|
180
|
-
# metadata: { "
|
191
|
+
# metadata: { "customKey": "a different custom value" }
|
181
192
|
# )
|
182
193
|
def update(id:, title: nil, alt: nil, metadata: nil, request_options: nil)
|
183
194
|
response = @request_client.conn.patch do |req|
|
@@ -185,9 +196,10 @@ module Ittybit
|
|
185
196
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
186
197
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
187
198
|
req.headers = {
|
188
|
-
|
189
|
-
|
190
|
-
|
199
|
+
**(req.headers || {}),
|
200
|
+
**@request_client.get_headers,
|
201
|
+
**(request_options&.additional_headers || {}),
|
202
|
+
"Accept-Version": "2025-08-20"
|
191
203
|
}.compact
|
192
204
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
193
205
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -200,7 +212,7 @@ module Ittybit
|
|
200
212
|
}.compact
|
201
213
|
req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
|
202
214
|
end
|
203
|
-
Ittybit::
|
215
|
+
Ittybit::Media::MediaUpdateResponse.from_json(json_object: response.body)
|
204
216
|
end
|
205
217
|
end
|
206
218
|
|
@@ -219,7 +231,7 @@ module Ittybit
|
|
219
231
|
# @param page [Integer]
|
220
232
|
# @param limit [Integer]
|
221
233
|
# @param request_options [Ittybit::RequestOptions]
|
222
|
-
# @return [Ittybit::
|
234
|
+
# @return [Ittybit::MEDIA_LIST_RESPONSE]
|
223
235
|
# @example
|
224
236
|
# api = Ittybit::Client.new(
|
225
237
|
# base_url: "https://api.example.com",
|
@@ -234,9 +246,10 @@ module Ittybit
|
|
234
246
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
235
247
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
236
248
|
req.headers = {
|
237
|
-
|
238
|
-
|
239
|
-
|
249
|
+
**(req.headers || {}),
|
250
|
+
**@request_client.get_headers,
|
251
|
+
**(request_options&.additional_headers || {}),
|
252
|
+
"Accept-Version": "2025-08-20"
|
240
253
|
}.compact
|
241
254
|
req.params = { **(request_options&.additional_query_parameters || {}), "page": page, "limit": limit }.compact
|
242
255
|
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
@@ -244,7 +257,11 @@ module Ittybit
|
|
244
257
|
end
|
245
258
|
req.url "#{@request_client.get_url(request_options: request_options)}/media"
|
246
259
|
end
|
247
|
-
|
260
|
+
parsed_json = JSON.parse(response.body)
|
261
|
+
parsed_json&.map do |item|
|
262
|
+
item = item.to_json
|
263
|
+
Ittybit::MediaListResponseItem.from_json(json_object: item)
|
264
|
+
end
|
248
265
|
end
|
249
266
|
end
|
250
267
|
|
@@ -254,7 +271,7 @@ module Ittybit
|
|
254
271
|
# @param alt [String]
|
255
272
|
# @param metadata [Hash{String => Object}]
|
256
273
|
# @param request_options [Ittybit::RequestOptions]
|
257
|
-
# @return [Ittybit::
|
274
|
+
# @return [Ittybit::Media::MediaCreateResponse]
|
258
275
|
# @example
|
259
276
|
# api = Ittybit::Client.new(
|
260
277
|
# base_url: "https://api.example.com",
|
@@ -264,7 +281,7 @@ module Ittybit
|
|
264
281
|
# api.media.create(
|
265
282
|
# title: "My Video Example",
|
266
283
|
# alt: "An example video used to demonstrate the ittybit API",
|
267
|
-
# metadata: { "
|
284
|
+
# metadata: { "customKey": "your custom value" }
|
268
285
|
# )
|
269
286
|
def create(title: nil, alt: nil, metadata: nil, request_options: nil)
|
270
287
|
Async do
|
@@ -273,9 +290,10 @@ module Ittybit
|
|
273
290
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
274
291
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
275
292
|
req.headers = {
|
276
|
-
|
277
|
-
|
278
|
-
|
293
|
+
**(req.headers || {}),
|
294
|
+
**@request_client.get_headers,
|
295
|
+
**(request_options&.additional_headers || {}),
|
296
|
+
"Accept-Version": "2025-08-20"
|
279
297
|
}.compact
|
280
298
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
281
299
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -288,7 +306,7 @@ module Ittybit
|
|
288
306
|
}.compact
|
289
307
|
req.url "#{@request_client.get_url(request_options: request_options)}/media"
|
290
308
|
end
|
291
|
-
Ittybit::
|
309
|
+
Ittybit::Media::MediaCreateResponse.from_json(json_object: response.body)
|
292
310
|
end
|
293
311
|
end
|
294
312
|
|
@@ -296,7 +314,7 @@ module Ittybit
|
|
296
314
|
#
|
297
315
|
# @param id [String]
|
298
316
|
# @param request_options [Ittybit::RequestOptions]
|
299
|
-
# @return [Ittybit::
|
317
|
+
# @return [Ittybit::Media::MediaGetResponse]
|
300
318
|
# @example
|
301
319
|
# api = Ittybit::Client.new(
|
302
320
|
# base_url: "https://api.example.com",
|
@@ -311,9 +329,10 @@ module Ittybit
|
|
311
329
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
312
330
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
313
331
|
req.headers = {
|
314
|
-
|
315
|
-
|
316
|
-
|
332
|
+
**(req.headers || {}),
|
333
|
+
**@request_client.get_headers,
|
334
|
+
**(request_options&.additional_headers || {}),
|
335
|
+
"Accept-Version": "2025-08-20"
|
317
336
|
}.compact
|
318
337
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
319
338
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -323,7 +342,7 @@ module Ittybit
|
|
323
342
|
end
|
324
343
|
req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
|
325
344
|
end
|
326
|
-
Ittybit::
|
345
|
+
Ittybit::Media::MediaGetResponse.from_json(json_object: response.body)
|
327
346
|
end
|
328
347
|
end
|
329
348
|
|
@@ -332,7 +351,7 @@ module Ittybit
|
|
332
351
|
#
|
333
352
|
# @param id [String]
|
334
353
|
# @param request_options [Ittybit::RequestOptions]
|
335
|
-
# @return [Ittybit::
|
354
|
+
# @return [Ittybit::Media::MediaDeleteResponse]
|
336
355
|
# @example
|
337
356
|
# api = Ittybit::Client.new(
|
338
357
|
# base_url: "https://api.example.com",
|
@@ -347,9 +366,10 @@ module Ittybit
|
|
347
366
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
348
367
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
349
368
|
req.headers = {
|
350
|
-
|
351
|
-
|
352
|
-
|
369
|
+
**(req.headers || {}),
|
370
|
+
**@request_client.get_headers,
|
371
|
+
**(request_options&.additional_headers || {}),
|
372
|
+
"Accept-Version": "2025-08-20"
|
353
373
|
}.compact
|
354
374
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
355
375
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -359,7 +379,7 @@ module Ittybit
|
|
359
379
|
end
|
360
380
|
req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
|
361
381
|
end
|
362
|
-
Ittybit::
|
382
|
+
Ittybit::Media::MediaDeleteResponse.from_json(json_object: response.body)
|
363
383
|
end
|
364
384
|
end
|
365
385
|
|
@@ -371,7 +391,7 @@ module Ittybit
|
|
371
391
|
# @param alt [String]
|
372
392
|
# @param metadata [Hash{String => Object}]
|
373
393
|
# @param request_options [Ittybit::RequestOptions]
|
374
|
-
# @return [Ittybit::
|
394
|
+
# @return [Ittybit::Media::MediaUpdateResponse]
|
375
395
|
# @example
|
376
396
|
# api = Ittybit::Client.new(
|
377
397
|
# base_url: "https://api.example.com",
|
@@ -382,7 +402,7 @@ module Ittybit
|
|
382
402
|
# id: "med_abcdefgh1234",
|
383
403
|
# title: "Updated Video Example",
|
384
404
|
# alt: "An updated example video used to demonstrate the ittybit API",
|
385
|
-
# metadata: { "
|
405
|
+
# metadata: { "customKey": "a different custom value" }
|
386
406
|
# )
|
387
407
|
def update(id:, title: nil, alt: nil, metadata: nil, request_options: nil)
|
388
408
|
Async do
|
@@ -391,9 +411,10 @@ module Ittybit
|
|
391
411
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
392
412
|
req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil?
|
393
413
|
req.headers = {
|
394
|
-
|
395
|
-
|
396
|
-
|
414
|
+
**(req.headers || {}),
|
415
|
+
**@request_client.get_headers,
|
416
|
+
**(request_options&.additional_headers || {}),
|
417
|
+
"Accept-Version": "2025-08-20"
|
397
418
|
}.compact
|
398
419
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
399
420
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
@@ -406,7 +427,7 @@ module Ittybit
|
|
406
427
|
}.compact
|
407
428
|
req.url "#{@request_client.get_url(request_options: request_options)}/media/#{id}"
|
408
429
|
end
|
409
|
-
Ittybit::
|
430
|
+
Ittybit::Media::MediaUpdateResponse.from_json(json_object: response.body)
|
410
431
|
end
|
411
432
|
end
|
412
433
|
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "media_create_response_kind"
|
4
|
+
require_relative "media_create_response_files_item"
|
5
|
+
require "date"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Ittybit
|
10
|
+
class Media
|
11
|
+
class MediaCreateResponse
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :id
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :object
|
16
|
+
# @return [Ittybit::Media::MediaCreateResponseKind]
|
17
|
+
attr_reader :kind
|
18
|
+
# @return [String]
|
19
|
+
attr_reader :title
|
20
|
+
# @return [String]
|
21
|
+
attr_reader :alt
|
22
|
+
# @return [Integer]
|
23
|
+
attr_reader :width
|
24
|
+
# @return [Integer]
|
25
|
+
attr_reader :height
|
26
|
+
# @return [Float]
|
27
|
+
attr_reader :duration
|
28
|
+
# @return [Array<Ittybit::Media::MediaCreateResponseFilesItem>]
|
29
|
+
attr_reader :files
|
30
|
+
# @return [Hash{String => Object}]
|
31
|
+
attr_reader :urls
|
32
|
+
# @return [String]
|
33
|
+
attr_reader :background
|
34
|
+
# @return [Hash{String => Object}]
|
35
|
+
attr_reader :metadata
|
36
|
+
# @return [DateTime]
|
37
|
+
attr_reader :created
|
38
|
+
# @return [DateTime]
|
39
|
+
attr_reader :updated
|
40
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
41
|
+
attr_reader :additional_properties
|
42
|
+
# @return [Object]
|
43
|
+
attr_reader :_field_set
|
44
|
+
protected :_field_set
|
45
|
+
|
46
|
+
OMIT = Object.new
|
47
|
+
|
48
|
+
# @param id [String]
|
49
|
+
# @param object [String]
|
50
|
+
# @param kind [Ittybit::Media::MediaCreateResponseKind]
|
51
|
+
# @param title [String]
|
52
|
+
# @param alt [String]
|
53
|
+
# @param width [Integer]
|
54
|
+
# @param height [Integer]
|
55
|
+
# @param duration [Float]
|
56
|
+
# @param files [Array<Ittybit::Media::MediaCreateResponseFilesItem>]
|
57
|
+
# @param urls [Hash{String => Object}]
|
58
|
+
# @param background [String]
|
59
|
+
# @param metadata [Hash{String => Object}]
|
60
|
+
# @param created [DateTime]
|
61
|
+
# @param updated [DateTime]
|
62
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
63
|
+
# @return [Ittybit::Media::MediaCreateResponse]
|
64
|
+
def initialize(id:, object:, files:, urls:, created:, updated:, kind: OMIT, title: OMIT, alt: OMIT, width: OMIT,
|
65
|
+
height: OMIT, duration: OMIT, background: OMIT, metadata: OMIT, additional_properties: nil)
|
66
|
+
@id = id
|
67
|
+
@object = object
|
68
|
+
@kind = kind if kind != OMIT
|
69
|
+
@title = title if title != OMIT
|
70
|
+
@alt = alt if alt != OMIT
|
71
|
+
@width = width if width != OMIT
|
72
|
+
@height = height if height != OMIT
|
73
|
+
@duration = duration if duration != OMIT
|
74
|
+
@files = files
|
75
|
+
@urls = urls
|
76
|
+
@background = background if background != OMIT
|
77
|
+
@metadata = metadata if metadata != OMIT
|
78
|
+
@created = created
|
79
|
+
@updated = updated
|
80
|
+
@additional_properties = additional_properties
|
81
|
+
@_field_set = {
|
82
|
+
"id": id,
|
83
|
+
"object": object,
|
84
|
+
"kind": kind,
|
85
|
+
"title": title,
|
86
|
+
"alt": alt,
|
87
|
+
"width": width,
|
88
|
+
"height": height,
|
89
|
+
"duration": duration,
|
90
|
+
"files": files,
|
91
|
+
"urls": urls,
|
92
|
+
"background": background,
|
93
|
+
"metadata": metadata,
|
94
|
+
"created": created,
|
95
|
+
"updated": updated
|
96
|
+
}.reject do |_k, v|
|
97
|
+
v == OMIT
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Deserialize a JSON object to an instance of MediaCreateResponse
|
102
|
+
#
|
103
|
+
# @param json_object [String]
|
104
|
+
# @return [Ittybit::Media::MediaCreateResponse]
|
105
|
+
def self.from_json(json_object:)
|
106
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
107
|
+
parsed_json = JSON.parse(json_object)
|
108
|
+
id = parsed_json["id"]
|
109
|
+
object = parsed_json["object"]
|
110
|
+
kind = parsed_json["kind"]
|
111
|
+
title = parsed_json["title"]
|
112
|
+
alt = parsed_json["alt"]
|
113
|
+
width = parsed_json["width"]
|
114
|
+
height = parsed_json["height"]
|
115
|
+
duration = parsed_json["duration"]
|
116
|
+
files = parsed_json["files"]&.map do |item|
|
117
|
+
item = item.to_json
|
118
|
+
Ittybit::Media::MediaCreateResponseFilesItem.from_json(json_object: item)
|
119
|
+
end
|
120
|
+
urls = parsed_json["urls"]
|
121
|
+
background = parsed_json["background"]
|
122
|
+
metadata = parsed_json["metadata"]
|
123
|
+
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
124
|
+
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
125
|
+
new(
|
126
|
+
id: id,
|
127
|
+
object: object,
|
128
|
+
kind: kind,
|
129
|
+
title: title,
|
130
|
+
alt: alt,
|
131
|
+
width: width,
|
132
|
+
height: height,
|
133
|
+
duration: duration,
|
134
|
+
files: files,
|
135
|
+
urls: urls,
|
136
|
+
background: background,
|
137
|
+
metadata: metadata,
|
138
|
+
created: created,
|
139
|
+
updated: updated,
|
140
|
+
additional_properties: struct
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Serialize an instance of MediaCreateResponse to a JSON object
|
145
|
+
#
|
146
|
+
# @return [String]
|
147
|
+
def to_json(*_args)
|
148
|
+
@_field_set&.to_json
|
149
|
+
end
|
150
|
+
|
151
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
152
|
+
# hash and check each fields type against the current object's property
|
153
|
+
# definitions.
|
154
|
+
#
|
155
|
+
# @param obj [Object]
|
156
|
+
# @return [Void]
|
157
|
+
def self.validate_raw(obj:)
|
158
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
159
|
+
obj.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
|
160
|
+
obj.kind&.is_a?(Ittybit::Media::MediaCreateResponseKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
161
|
+
obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
|
162
|
+
obj.alt&.is_a?(String) != false || raise("Passed value for field obj.alt is not the expected type, validation failed.")
|
163
|
+
obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.")
|
164
|
+
obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.")
|
165
|
+
obj.duration&.is_a?(Float) != false || raise("Passed value for field obj.duration is not the expected type, validation failed.")
|
166
|
+
obj.files.is_a?(Array) != false || raise("Passed value for field obj.files is not the expected type, validation failed.")
|
167
|
+
obj.urls.is_a?(Hash) != false || raise("Passed value for field obj.urls is not the expected type, validation failed.")
|
168
|
+
obj.background&.is_a?(String) != false || raise("Passed value for field obj.background is not the expected type, validation failed.")
|
169
|
+
obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
|
170
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
171
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|