fastpixapi 1.1.1 → 1.1.3
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/crystalline/metadata_fields.rb +56 -48
- data/lib/crystalline/types.rb +3 -3
- data/lib/crystalline.rb +4 -5
- data/lib/fastpix_client/dimensions.rb +55 -62
- data/lib/fastpix_client/drm_configurations.rb +51 -58
- data/lib/fastpix_client/errors.rb +36 -25
- data/lib/fastpix_client/fastpixapi.rb +2 -4
- data/lib/fastpix_client/in_video_ai_features.rb +108 -168
- data/lib/fastpix_client/input_video.rb +75 -83
- data/lib/fastpix_client/live_playback.rb +82 -99
- data/lib/fastpix_client/manage_live_stream.rb +145 -261
- data/lib/fastpix_client/manage_videos.rb +252 -567
- data/lib/fastpix_client/metrics.rb +82 -126
- data/lib/fastpix_client/models/components/addtrackrequest.rb +1 -1
- data/lib/fastpix_client/models/components/createlivestreamresponsedto.rb +10 -18
- data/lib/fastpix_client/models/components/createmediarequest.rb +10 -19
- data/lib/fastpix_client/models/components/deletesigningkeyresponse.rb +6 -2
- data/lib/fastpix_client/models/components/deletesigningkeyresponsedata.rb +33 -0
- data/lib/fastpix_client/models/components/getallmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/getcreatelivestreamresponsedto.rb +9 -20
- data/lib/fastpix_client/models/components/getmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/live_media_clips.rb +9 -21
- data/lib/fastpix_client/models/components/media.rb +11 -26
- data/lib/fastpix_client/models/components/patchresponsedata.rb +9 -18
- data/lib/fastpix_client/models/components/pullvideoinput.rb +1 -1
- data/lib/fastpix_client/models/components/sourceaccessmedia.rb +11 -26
- data/lib/fastpix_client/models/components/update_media.rb +11 -26
- data/lib/fastpix_client/models/components/views.rb +52 -125
- data/lib/fastpix_client/models/components/watermarkinput.rb +1 -1
- data/lib/fastpix_client/models/components.rb +1 -0
- data/lib/fastpix_client/models/errors/empty_response_error.rb +15 -0
- data/lib/fastpix_client/models/errors.rb +1 -0
- data/lib/fastpix_client/models/operations/add_media_to_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/add_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/cancel_upload_response.rb +1 -1
- data/lib/fastpix_client/models/operations/change_media_order_in_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/complete_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_media_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_new_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_playbackid_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_signing_key_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_from_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_playbackid_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_signing_key_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/direct_upload_video_media_request.rb +1 -1
- data/lib/fastpix_client/models/operations/direct_upload_video_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/disable_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/enable_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/generate_subtitle_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_all_playlists_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_all_streams_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_viewer_count_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_clips_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_summary_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_playlist_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_signing_key_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_specific_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_timeseries_data_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_video_view_details_response.rb +1 -1
- data/lib/fastpix_client/models/operations/getdrmconfiguration_response.rb +1 -1
- data/lib/fastpix_client/models/operations/getdrmconfigurationbyid_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_breakdown_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_by_top_content_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_comparison_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_dimensions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_errors_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_filter_values_for_dimension_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_live_clips_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_overall_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_playback_ids_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_signing_keys_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_uploads_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_video_views_response.rb +1 -1
- data/lib/fastpix_client/models/operations/push_media_settings.rb +10 -21
- data/lib/fastpix_client/models/operations/retrievemediainputinfo_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_domain_restrictions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_chapters_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_moderation_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_named_entities_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_summary_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_specific_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_user_agent_restrictions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_mp4support_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_source_access_response.rb +1 -1
- data/lib/fastpix_client/playback.rb +123 -214
- data/lib/fastpix_client/playlist.rb +151 -297
- data/lib/fastpix_client/sdk_hooks/registration.rb +2 -2
- data/lib/fastpix_client/sdk_hooks/types.rb +4 -0
- data/lib/fastpix_client/sdkconfiguration.rb +4 -4
- data/lib/fastpix_client/signing_keys.rb +79 -123
- data/lib/fastpix_client/simulcast_stream.rb +101 -145
- data/lib/fastpix_client/start_live_stream.rb +54 -36
- data/lib/fastpix_client/utils/forms.rb +97 -101
- data/lib/fastpix_client/utils/headers.rb +44 -34
- data/lib/fastpix_client/utils/query_params.rb +39 -29
- data/lib/fastpix_client/utils/request_bodies.rb +4 -8
- data/lib/fastpix_client/utils/security.rb +30 -18
- data/lib/fastpix_client/utils/url.rb +83 -55
- data/lib/fastpix_client/utils/utils.rb +19 -37
- data/lib/fastpix_client/views.rb +71 -95
- data/lib/fastpixapi.rb +10 -10
- data/lib/openssl_patch.rb +24 -24
- metadata +20 -4
|
@@ -14,6 +14,59 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class Playback
|
|
16
16
|
extend T::Sig
|
|
17
|
+
|
|
18
|
+
API_ERROR_OCCURRED = 'API error occurred'
|
|
19
|
+
CONTENT_TYPE_HEADER = 'Content-Type'
|
|
20
|
+
CONTENT_TYPE_JSON = 'application/json'
|
|
21
|
+
DEFAULT_CONTENT_TYPE = 'application/octet-stream'
|
|
22
|
+
PLAYBACK_IDS_PATH = '/on-demand/{mediaId}/playback-ids'
|
|
23
|
+
REQUEST_CONTENT_TYPE_HEADER = 'content-type'
|
|
24
|
+
UNKNOWN_CONTENT_TYPE_ERROR = 'Unknown content type received'
|
|
25
|
+
USER_AGENT_HEADER = 'user-agent'
|
|
26
|
+
|
|
27
|
+
# Applies the SDK after-request hooks and ensures a usable response is present.
|
|
28
|
+
sig { params(http_response: T.nilable(Faraday::Response), error: T.nilable(StandardError), hook_ctx: SDKHooks::HookContext).returns(Faraday::Response) }
|
|
29
|
+
def apply_after_request_hooks(http_response, error, hook_ctx)
|
|
30
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
31
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
32
|
+
error: error,
|
|
33
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
34
|
+
hook_ctx: hook_ctx
|
|
35
|
+
),
|
|
36
|
+
response: http_response
|
|
37
|
+
)
|
|
38
|
+
else
|
|
39
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
40
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
41
|
+
hook_ctx: hook_ctx
|
|
42
|
+
),
|
|
43
|
+
response: http_response
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
if http_response.nil?
|
|
48
|
+
raise error unless error.nil?
|
|
49
|
+
raise ::FastpixClient::Models::Errors::EmptyResponseError, 'no response'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
http_response
|
|
53
|
+
end
|
|
54
|
+
private :apply_after_request_hooks
|
|
55
|
+
|
|
56
|
+
# Encodes the request body based on its serialized content type.
|
|
57
|
+
sig { params(req_content_type: T.nilable(String), data: T.untyped, form: T.untyped).returns(T.untyped) }
|
|
58
|
+
def encode_request_body(req_content_type, data, form)
|
|
59
|
+
raise ArgumentError, 'request body is required' if data.nil? && form.nil?
|
|
60
|
+
|
|
61
|
+
if form
|
|
62
|
+
Utils.encode_form(form)
|
|
63
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
64
|
+
URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
65
|
+
else
|
|
66
|
+
data
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
private :encode_request_body
|
|
17
70
|
|
|
18
71
|
# Operations for video playback management
|
|
19
72
|
|
|
@@ -42,7 +95,7 @@ module FastpixClient
|
|
|
42
95
|
sig { params(body: Models::Operations::CreateMediaPlaybackIdRequestBody, media_id: ::String, timeout_ms: T.nilable(Integer)).returns(Models::Operations::CreateMediaPlaybackIdResponse) }
|
|
43
96
|
def create_media_playback_id(body:, media_id:, timeout_ms: nil)
|
|
44
97
|
# create_media_playback_id - Create a playback ID
|
|
45
|
-
# You can create a new playback ID for a specific media asset. If you have already retrieved an existing `playbackId` using the <a href="https://
|
|
98
|
+
# You can create a new playback ID for a specific media asset. If you have already retrieved an existing `playbackId` using the <a href="https://fastpix.com/docs/video-on-demand-api/manage-videos/get-media">Get Media by ID</a> endpoint for a media asset, you can use this endpoint to generate a new playback ID with a specified access policy.
|
|
46
99
|
#
|
|
47
100
|
#
|
|
48
101
|
#
|
|
@@ -69,24 +122,16 @@ module FastpixClient
|
|
|
69
122
|
url = Utils.generate_url(
|
|
70
123
|
Models::Operations::CreateMediaPlaybackIdRequest,
|
|
71
124
|
base_url,
|
|
72
|
-
|
|
125
|
+
PLAYBACK_IDS_PATH,
|
|
73
126
|
request
|
|
74
127
|
)
|
|
75
128
|
headers = {}
|
|
76
129
|
headers = T.cast(headers, T::Hash[String, String])
|
|
77
130
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
78
|
-
headers[
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
body = Utils.encode_form(form)
|
|
83
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
84
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
85
|
-
else
|
|
86
|
-
body = data
|
|
87
|
-
end
|
|
88
|
-
headers['Accept'] = 'application/json'
|
|
89
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
131
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
132
|
+
body = encode_request_body(req_content_type, data, form)
|
|
133
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
134
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
90
135
|
|
|
91
136
|
security = @sdk_configuration.security_source&.call
|
|
92
137
|
|
|
@@ -125,32 +170,12 @@ module FastpixClient
|
|
|
125
170
|
rescue StandardError => e
|
|
126
171
|
error = e
|
|
127
172
|
ensure
|
|
128
|
-
|
|
129
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
130
|
-
error: error,
|
|
131
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
132
|
-
hook_ctx: hook_ctx
|
|
133
|
-
),
|
|
134
|
-
response: http_response
|
|
135
|
-
)
|
|
136
|
-
else
|
|
137
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
138
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
139
|
-
hook_ctx: hook_ctx
|
|
140
|
-
),
|
|
141
|
-
response: http_response
|
|
142
|
-
)
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
if http_response.nil?
|
|
146
|
-
raise error if !error.nil?
|
|
147
|
-
raise 'no response'
|
|
148
|
-
end
|
|
173
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
149
174
|
end
|
|
150
175
|
|
|
151
|
-
content_type = http_response.headers.fetch(
|
|
176
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
152
177
|
if Utils.match_status_code(http_response.status, ['201'])
|
|
153
|
-
if Utils.match_content_type(content_type,
|
|
178
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
154
179
|
http_response = @sdk_configuration.hooks.after_success(
|
|
155
180
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
156
181
|
hook_ctx: hook_ctx
|
|
@@ -168,14 +193,14 @@ module FastpixClient
|
|
|
168
193
|
|
|
169
194
|
return response
|
|
170
195
|
else
|
|
171
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
196
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
172
197
|
end
|
|
173
198
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
174
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
199
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
175
200
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
176
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
201
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
177
202
|
else
|
|
178
|
-
if Utils.match_content_type(content_type,
|
|
203
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
179
204
|
http_response = @sdk_configuration.hooks.after_success(
|
|
180
205
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
181
206
|
hook_ctx: hook_ctx
|
|
@@ -193,7 +218,7 @@ module FastpixClient
|
|
|
193
218
|
|
|
194
219
|
return response
|
|
195
220
|
else
|
|
196
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
221
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
197
222
|
end
|
|
198
223
|
end
|
|
199
224
|
end
|
|
@@ -219,13 +244,13 @@ module FastpixClient
|
|
|
219
244
|
url = Utils.generate_url(
|
|
220
245
|
Models::Operations::ListPlaybackIdsRequest,
|
|
221
246
|
base_url,
|
|
222
|
-
|
|
247
|
+
PLAYBACK_IDS_PATH,
|
|
223
248
|
request
|
|
224
249
|
)
|
|
225
250
|
headers = {}
|
|
226
251
|
headers = T.cast(headers, T::Hash[String, String])
|
|
227
|
-
headers['Accept'] =
|
|
228
|
-
headers[
|
|
252
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
253
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
229
254
|
|
|
230
255
|
security = @sdk_configuration.security_source&.call
|
|
231
256
|
|
|
@@ -263,32 +288,12 @@ module FastpixClient
|
|
|
263
288
|
rescue StandardError => e
|
|
264
289
|
error = e
|
|
265
290
|
ensure
|
|
266
|
-
|
|
267
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
268
|
-
error: error,
|
|
269
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
270
|
-
hook_ctx: hook_ctx
|
|
271
|
-
),
|
|
272
|
-
response: http_response
|
|
273
|
-
)
|
|
274
|
-
else
|
|
275
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
276
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
277
|
-
hook_ctx: hook_ctx
|
|
278
|
-
),
|
|
279
|
-
response: http_response
|
|
280
|
-
)
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
if http_response.nil?
|
|
284
|
-
raise error if !error.nil?
|
|
285
|
-
raise 'no response'
|
|
286
|
-
end
|
|
291
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
287
292
|
end
|
|
288
293
|
|
|
289
|
-
content_type = http_response.headers.fetch(
|
|
294
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
290
295
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
291
|
-
if Utils.match_content_type(content_type,
|
|
296
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
292
297
|
http_response = @sdk_configuration.hooks.after_success(
|
|
293
298
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
294
299
|
hook_ctx: hook_ctx
|
|
@@ -306,14 +311,14 @@ module FastpixClient
|
|
|
306
311
|
|
|
307
312
|
return response
|
|
308
313
|
else
|
|
309
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
314
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
310
315
|
end
|
|
311
316
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
312
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
317
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
313
318
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
314
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
319
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
315
320
|
else
|
|
316
|
-
if Utils.match_content_type(content_type,
|
|
321
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
317
322
|
http_response = @sdk_configuration.hooks.after_success(
|
|
318
323
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
319
324
|
hook_ctx: hook_ctx
|
|
@@ -331,7 +336,7 @@ module FastpixClient
|
|
|
331
336
|
|
|
332
337
|
return response
|
|
333
338
|
else
|
|
334
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
339
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
335
340
|
end
|
|
336
341
|
end
|
|
337
342
|
end
|
|
@@ -362,14 +367,14 @@ module FastpixClient
|
|
|
362
367
|
url = Utils.generate_url(
|
|
363
368
|
Models::Operations::DeleteMediaPlaybackIdRequest,
|
|
364
369
|
base_url,
|
|
365
|
-
|
|
370
|
+
PLAYBACK_IDS_PATH,
|
|
366
371
|
request
|
|
367
372
|
)
|
|
368
373
|
headers = {}
|
|
369
374
|
headers = T.cast(headers, T::Hash[String, String])
|
|
370
375
|
query_params = Utils.get_query_params(Models::Operations::DeleteMediaPlaybackIdRequest, request, nil)
|
|
371
|
-
headers['Accept'] =
|
|
372
|
-
headers[
|
|
376
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
377
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
373
378
|
|
|
374
379
|
security = @sdk_configuration.security_source&.call
|
|
375
380
|
|
|
@@ -408,32 +413,12 @@ module FastpixClient
|
|
|
408
413
|
rescue StandardError => e
|
|
409
414
|
error = e
|
|
410
415
|
ensure
|
|
411
|
-
|
|
412
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
413
|
-
error: error,
|
|
414
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
415
|
-
hook_ctx: hook_ctx
|
|
416
|
-
),
|
|
417
|
-
response: http_response
|
|
418
|
-
)
|
|
419
|
-
else
|
|
420
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
421
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
422
|
-
hook_ctx: hook_ctx
|
|
423
|
-
),
|
|
424
|
-
response: http_response
|
|
425
|
-
)
|
|
426
|
-
end
|
|
427
|
-
|
|
428
|
-
if http_response.nil?
|
|
429
|
-
raise error if !error.nil?
|
|
430
|
-
raise 'no response'
|
|
431
|
-
end
|
|
416
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
432
417
|
end
|
|
433
418
|
|
|
434
|
-
content_type = http_response.headers.fetch(
|
|
419
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
435
420
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
436
|
-
if Utils.match_content_type(content_type,
|
|
421
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
437
422
|
http_response = @sdk_configuration.hooks.after_success(
|
|
438
423
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
439
424
|
hook_ctx: hook_ctx
|
|
@@ -451,14 +436,14 @@ module FastpixClient
|
|
|
451
436
|
|
|
452
437
|
return response
|
|
453
438
|
else
|
|
454
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
439
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
455
440
|
end
|
|
456
441
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
457
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
442
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
458
443
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
459
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
444
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
460
445
|
else
|
|
461
|
-
if Utils.match_content_type(content_type,
|
|
446
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
462
447
|
http_response = @sdk_configuration.hooks.after_success(
|
|
463
448
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
464
449
|
hook_ctx: hook_ctx
|
|
@@ -476,7 +461,7 @@ module FastpixClient
|
|
|
476
461
|
|
|
477
462
|
return response
|
|
478
463
|
else
|
|
479
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
464
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
480
465
|
end
|
|
481
466
|
end
|
|
482
467
|
end
|
|
@@ -508,8 +493,8 @@ module FastpixClient
|
|
|
508
493
|
)
|
|
509
494
|
headers = {}
|
|
510
495
|
headers = T.cast(headers, T::Hash[String, String])
|
|
511
|
-
headers['Accept'] =
|
|
512
|
-
headers[
|
|
496
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
497
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
513
498
|
|
|
514
499
|
security = @sdk_configuration.security_source&.call
|
|
515
500
|
|
|
@@ -547,32 +532,12 @@ module FastpixClient
|
|
|
547
532
|
rescue StandardError => e
|
|
548
533
|
error = e
|
|
549
534
|
ensure
|
|
550
|
-
|
|
551
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
552
|
-
error: error,
|
|
553
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
554
|
-
hook_ctx: hook_ctx
|
|
555
|
-
),
|
|
556
|
-
response: http_response
|
|
557
|
-
)
|
|
558
|
-
else
|
|
559
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
560
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
561
|
-
hook_ctx: hook_ctx
|
|
562
|
-
),
|
|
563
|
-
response: http_response
|
|
564
|
-
)
|
|
565
|
-
end
|
|
566
|
-
|
|
567
|
-
if http_response.nil?
|
|
568
|
-
raise error if !error.nil?
|
|
569
|
-
raise 'no response'
|
|
570
|
-
end
|
|
535
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
571
536
|
end
|
|
572
537
|
|
|
573
|
-
content_type = http_response.headers.fetch(
|
|
538
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
574
539
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
575
|
-
if Utils.match_content_type(content_type,
|
|
540
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
576
541
|
http_response = @sdk_configuration.hooks.after_success(
|
|
577
542
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
578
543
|
hook_ctx: hook_ctx
|
|
@@ -590,14 +555,14 @@ module FastpixClient
|
|
|
590
555
|
|
|
591
556
|
return response
|
|
592
557
|
else
|
|
593
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
558
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
594
559
|
end
|
|
595
560
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
596
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
561
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
597
562
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
598
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
563
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
599
564
|
else
|
|
600
|
-
if Utils.match_content_type(content_type,
|
|
565
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
601
566
|
http_response = @sdk_configuration.hooks.after_success(
|
|
602
567
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
603
568
|
hook_ctx: hook_ctx
|
|
@@ -615,7 +580,7 @@ module FastpixClient
|
|
|
615
580
|
|
|
616
581
|
return response
|
|
617
582
|
else
|
|
618
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
583
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
619
584
|
end
|
|
620
585
|
end
|
|
621
586
|
end
|
|
@@ -651,18 +616,10 @@ module FastpixClient
|
|
|
651
616
|
headers = {}
|
|
652
617
|
headers = T.cast(headers, T::Hash[String, String])
|
|
653
618
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
654
|
-
headers[
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
body = Utils.encode_form(form)
|
|
659
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
660
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
661
|
-
else
|
|
662
|
-
body = data
|
|
663
|
-
end
|
|
664
|
-
headers['Accept'] = 'application/json'
|
|
665
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
619
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
620
|
+
body = encode_request_body(req_content_type, data, form)
|
|
621
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
622
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
666
623
|
|
|
667
624
|
security = @sdk_configuration.security_source&.call
|
|
668
625
|
|
|
@@ -701,32 +658,12 @@ module FastpixClient
|
|
|
701
658
|
rescue StandardError => e
|
|
702
659
|
error = e
|
|
703
660
|
ensure
|
|
704
|
-
|
|
705
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
706
|
-
error: error,
|
|
707
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
708
|
-
hook_ctx: hook_ctx
|
|
709
|
-
),
|
|
710
|
-
response: http_response
|
|
711
|
-
)
|
|
712
|
-
else
|
|
713
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
714
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
715
|
-
hook_ctx: hook_ctx
|
|
716
|
-
),
|
|
717
|
-
response: http_response
|
|
718
|
-
)
|
|
719
|
-
end
|
|
720
|
-
|
|
721
|
-
if http_response.nil?
|
|
722
|
-
raise error if !error.nil?
|
|
723
|
-
raise 'no response'
|
|
724
|
-
end
|
|
661
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
725
662
|
end
|
|
726
663
|
|
|
727
|
-
content_type = http_response.headers.fetch(
|
|
664
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
728
665
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
729
|
-
if Utils.match_content_type(content_type,
|
|
666
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
730
667
|
http_response = @sdk_configuration.hooks.after_success(
|
|
731
668
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
732
669
|
hook_ctx: hook_ctx
|
|
@@ -744,14 +681,14 @@ module FastpixClient
|
|
|
744
681
|
|
|
745
682
|
return response
|
|
746
683
|
else
|
|
747
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
684
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
748
685
|
end
|
|
749
686
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
750
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
687
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
751
688
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
752
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
689
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
753
690
|
else
|
|
754
|
-
if Utils.match_content_type(content_type,
|
|
691
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
755
692
|
http_response = @sdk_configuration.hooks.after_success(
|
|
756
693
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
757
694
|
hook_ctx: hook_ctx
|
|
@@ -769,7 +706,7 @@ module FastpixClient
|
|
|
769
706
|
|
|
770
707
|
return response
|
|
771
708
|
else
|
|
772
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
709
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
773
710
|
end
|
|
774
711
|
end
|
|
775
712
|
end
|
|
@@ -805,18 +742,10 @@ module FastpixClient
|
|
|
805
742
|
headers = {}
|
|
806
743
|
headers = T.cast(headers, T::Hash[String, String])
|
|
807
744
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
808
|
-
headers[
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
body = Utils.encode_form(form)
|
|
813
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
814
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
815
|
-
else
|
|
816
|
-
body = data
|
|
817
|
-
end
|
|
818
|
-
headers['Accept'] = 'application/json'
|
|
819
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
745
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
746
|
+
body = encode_request_body(req_content_type, data, form)
|
|
747
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
748
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
820
749
|
|
|
821
750
|
security = @sdk_configuration.security_source&.call
|
|
822
751
|
|
|
@@ -855,32 +784,12 @@ module FastpixClient
|
|
|
855
784
|
rescue StandardError => e
|
|
856
785
|
error = e
|
|
857
786
|
ensure
|
|
858
|
-
|
|
859
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
860
|
-
error: error,
|
|
861
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
862
|
-
hook_ctx: hook_ctx
|
|
863
|
-
),
|
|
864
|
-
response: http_response
|
|
865
|
-
)
|
|
866
|
-
else
|
|
867
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
868
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
869
|
-
hook_ctx: hook_ctx
|
|
870
|
-
),
|
|
871
|
-
response: http_response
|
|
872
|
-
)
|
|
873
|
-
end
|
|
874
|
-
|
|
875
|
-
if http_response.nil?
|
|
876
|
-
raise error if !error.nil?
|
|
877
|
-
raise 'no response'
|
|
878
|
-
end
|
|
787
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
879
788
|
end
|
|
880
789
|
|
|
881
|
-
content_type = http_response.headers.fetch(
|
|
790
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
882
791
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
883
|
-
if Utils.match_content_type(content_type,
|
|
792
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
884
793
|
http_response = @sdk_configuration.hooks.after_success(
|
|
885
794
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
886
795
|
hook_ctx: hook_ctx
|
|
@@ -898,14 +807,14 @@ module FastpixClient
|
|
|
898
807
|
|
|
899
808
|
return response
|
|
900
809
|
else
|
|
901
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
810
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
902
811
|
end
|
|
903
812
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
904
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
813
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
905
814
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
906
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
815
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
907
816
|
else
|
|
908
|
-
if Utils.match_content_type(content_type,
|
|
817
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
909
818
|
http_response = @sdk_configuration.hooks.after_success(
|
|
910
819
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
911
820
|
hook_ctx: hook_ctx
|
|
@@ -923,7 +832,7 @@ module FastpixClient
|
|
|
923
832
|
|
|
924
833
|
return response
|
|
925
834
|
else
|
|
926
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
835
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
927
836
|
end
|
|
928
837
|
end
|
|
929
838
|
end
|