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,60 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class Playlist
|
|
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
|
+
PLAYLIST_MEDIA_PATH = '/on-demand/playlists/{playlistId}/media'
|
|
23
|
+
PLAYLIST_PATH = '/on-demand/playlists/{playlistId}'
|
|
24
|
+
REQUEST_CONTENT_TYPE_HEADER = 'content-type'
|
|
25
|
+
UNKNOWN_CONTENT_TYPE_ERROR = 'Unknown content type received'
|
|
26
|
+
USER_AGENT_HEADER = 'user-agent'
|
|
27
|
+
|
|
28
|
+
# Applies the SDK after-request hooks and ensures a usable response is present.
|
|
29
|
+
sig { params(http_response: T.nilable(Faraday::Response), error: T.nilable(StandardError), hook_ctx: SDKHooks::HookContext).returns(Faraday::Response) }
|
|
30
|
+
def apply_after_request_hooks(http_response, error, hook_ctx)
|
|
31
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
32
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
33
|
+
error: error,
|
|
34
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
35
|
+
hook_ctx: hook_ctx
|
|
36
|
+
),
|
|
37
|
+
response: http_response
|
|
38
|
+
)
|
|
39
|
+
else
|
|
40
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
41
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
42
|
+
hook_ctx: hook_ctx
|
|
43
|
+
),
|
|
44
|
+
response: http_response
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if http_response.nil?
|
|
49
|
+
raise error unless error.nil?
|
|
50
|
+
raise ::FastpixClient::Models::Errors::EmptyResponseError, 'no response'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
http_response
|
|
54
|
+
end
|
|
55
|
+
private :apply_after_request_hooks
|
|
56
|
+
|
|
57
|
+
# Encodes the request body based on its serialized content type.
|
|
58
|
+
sig { params(req_content_type: T.nilable(String), data: T.untyped, form: T.untyped).returns(T.untyped) }
|
|
59
|
+
def encode_request_body(req_content_type, data, form)
|
|
60
|
+
raise ArgumentError, 'request body is required' if data.nil? && form.nil?
|
|
61
|
+
|
|
62
|
+
if form
|
|
63
|
+
Utils.encode_form(form)
|
|
64
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
65
|
+
URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
66
|
+
else
|
|
67
|
+
data
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
private :encode_request_body
|
|
17
71
|
|
|
18
72
|
# Operations for playlist management
|
|
19
73
|
|
|
@@ -47,7 +101,7 @@ module FastpixClient
|
|
|
47
101
|
# - **Manual:** Creates an empty playlist without any initial media items. Use this mode for manual curation, where you add items later in a user-defined sequence.
|
|
48
102
|
# - **Smart:** Auto-populates the playlist at creation time based on the filter criteria (for example, a video creation date range) that you provide in the request.
|
|
49
103
|
#
|
|
50
|
-
# For more details, see <a href="https://
|
|
104
|
+
# For more details, see <a href="https://fastpix.com/docs/playback-and-delivery/create-and-manage-playlists">Create and manage playlist</a>.
|
|
51
105
|
#
|
|
52
106
|
# #### How it works
|
|
53
107
|
#
|
|
@@ -63,18 +117,10 @@ module FastpixClient
|
|
|
63
117
|
headers = {}
|
|
64
118
|
headers = T.cast(headers, T::Hash[String, String])
|
|
65
119
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :request, :json)
|
|
66
|
-
headers[
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
body = Utils.encode_form(form)
|
|
71
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
72
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
73
|
-
else
|
|
74
|
-
body = data
|
|
75
|
-
end
|
|
76
|
-
headers['Accept'] = 'application/json'
|
|
77
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
120
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
121
|
+
body = encode_request_body(req_content_type, data, form)
|
|
122
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
123
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
78
124
|
|
|
79
125
|
security = @sdk_configuration.security_source&.call
|
|
80
126
|
|
|
@@ -113,32 +159,12 @@ module FastpixClient
|
|
|
113
159
|
rescue StandardError => e
|
|
114
160
|
error = e
|
|
115
161
|
ensure
|
|
116
|
-
|
|
117
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
118
|
-
error: error,
|
|
119
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
120
|
-
hook_ctx: hook_ctx
|
|
121
|
-
),
|
|
122
|
-
response: http_response
|
|
123
|
-
)
|
|
124
|
-
else
|
|
125
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
126
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
127
|
-
hook_ctx: hook_ctx
|
|
128
|
-
),
|
|
129
|
-
response: http_response
|
|
130
|
-
)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
if http_response.nil?
|
|
134
|
-
raise error if !error.nil?
|
|
135
|
-
raise 'no response'
|
|
136
|
-
end
|
|
162
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
137
163
|
end
|
|
138
164
|
|
|
139
|
-
content_type = http_response.headers.fetch(
|
|
165
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
140
166
|
if Utils.match_status_code(http_response.status, ['201'])
|
|
141
|
-
if Utils.match_content_type(content_type,
|
|
167
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
142
168
|
http_response = @sdk_configuration.hooks.after_success(
|
|
143
169
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
144
170
|
hook_ctx: hook_ctx
|
|
@@ -156,14 +182,14 @@ module FastpixClient
|
|
|
156
182
|
|
|
157
183
|
return response
|
|
158
184
|
else
|
|
159
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
185
|
+
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
|
|
160
186
|
end
|
|
161
187
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
162
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
188
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
163
189
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
164
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
190
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
165
191
|
else
|
|
166
|
-
if Utils.match_content_type(content_type,
|
|
192
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
167
193
|
http_response = @sdk_configuration.hooks.after_success(
|
|
168
194
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
169
195
|
hook_ctx: hook_ctx
|
|
@@ -181,7 +207,7 @@ module FastpixClient
|
|
|
181
207
|
|
|
182
208
|
return response
|
|
183
209
|
else
|
|
184
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
210
|
+
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
|
|
185
211
|
end
|
|
186
212
|
end
|
|
187
213
|
end
|
|
@@ -208,8 +234,8 @@ module FastpixClient
|
|
|
208
234
|
headers = {}
|
|
209
235
|
headers = T.cast(headers, T::Hash[String, String])
|
|
210
236
|
query_params = Utils.get_query_params(Models::Operations::GetAllPlaylistsRequest, request, nil)
|
|
211
|
-
headers['Accept'] =
|
|
212
|
-
headers[
|
|
237
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
238
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
213
239
|
|
|
214
240
|
security = @sdk_configuration.security_source&.call
|
|
215
241
|
|
|
@@ -248,32 +274,12 @@ module FastpixClient
|
|
|
248
274
|
rescue StandardError => e
|
|
249
275
|
error = e
|
|
250
276
|
ensure
|
|
251
|
-
|
|
252
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
253
|
-
error: error,
|
|
254
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
255
|
-
hook_ctx: hook_ctx
|
|
256
|
-
),
|
|
257
|
-
response: http_response
|
|
258
|
-
)
|
|
259
|
-
else
|
|
260
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
261
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
262
|
-
hook_ctx: hook_ctx
|
|
263
|
-
),
|
|
264
|
-
response: http_response
|
|
265
|
-
)
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
if http_response.nil?
|
|
269
|
-
raise error if !error.nil?
|
|
270
|
-
raise 'no response'
|
|
271
|
-
end
|
|
277
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
272
278
|
end
|
|
273
279
|
|
|
274
|
-
content_type = http_response.headers.fetch(
|
|
280
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
275
281
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
276
|
-
if Utils.match_content_type(content_type,
|
|
282
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
277
283
|
http_response = @sdk_configuration.hooks.after_success(
|
|
278
284
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
279
285
|
hook_ctx: hook_ctx
|
|
@@ -291,14 +297,14 @@ module FastpixClient
|
|
|
291
297
|
|
|
292
298
|
return response
|
|
293
299
|
else
|
|
294
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
300
|
+
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
|
|
295
301
|
end
|
|
296
302
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
297
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
303
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
298
304
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
299
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
305
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
300
306
|
else
|
|
301
|
-
if Utils.match_content_type(content_type,
|
|
307
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
302
308
|
http_response = @sdk_configuration.hooks.after_success(
|
|
303
309
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
304
310
|
hook_ctx: hook_ctx
|
|
@@ -316,7 +322,7 @@ module FastpixClient
|
|
|
316
322
|
|
|
317
323
|
return response
|
|
318
324
|
else
|
|
319
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
325
|
+
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
|
|
320
326
|
end
|
|
321
327
|
end
|
|
322
328
|
end
|
|
@@ -338,13 +344,13 @@ module FastpixClient
|
|
|
338
344
|
url = Utils.generate_url(
|
|
339
345
|
Models::Operations::GetPlaylistByIdRequest,
|
|
340
346
|
base_url,
|
|
341
|
-
|
|
347
|
+
PLAYLIST_PATH,
|
|
342
348
|
request
|
|
343
349
|
)
|
|
344
350
|
headers = {}
|
|
345
351
|
headers = T.cast(headers, T::Hash[String, String])
|
|
346
|
-
headers['Accept'] =
|
|
347
|
-
headers[
|
|
352
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
353
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
348
354
|
|
|
349
355
|
security = @sdk_configuration.security_source&.call
|
|
350
356
|
|
|
@@ -382,32 +388,12 @@ module FastpixClient
|
|
|
382
388
|
rescue StandardError => e
|
|
383
389
|
error = e
|
|
384
390
|
ensure
|
|
385
|
-
|
|
386
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
387
|
-
error: error,
|
|
388
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
389
|
-
hook_ctx: hook_ctx
|
|
390
|
-
),
|
|
391
|
-
response: http_response
|
|
392
|
-
)
|
|
393
|
-
else
|
|
394
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
395
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
396
|
-
hook_ctx: hook_ctx
|
|
397
|
-
),
|
|
398
|
-
response: http_response
|
|
399
|
-
)
|
|
400
|
-
end
|
|
401
|
-
|
|
402
|
-
if http_response.nil?
|
|
403
|
-
raise error if !error.nil?
|
|
404
|
-
raise 'no response'
|
|
405
|
-
end
|
|
391
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
406
392
|
end
|
|
407
393
|
|
|
408
|
-
content_type = http_response.headers.fetch(
|
|
394
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
409
395
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
410
|
-
if Utils.match_content_type(content_type,
|
|
396
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
411
397
|
http_response = @sdk_configuration.hooks.after_success(
|
|
412
398
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
413
399
|
hook_ctx: hook_ctx
|
|
@@ -425,14 +411,14 @@ module FastpixClient
|
|
|
425
411
|
|
|
426
412
|
return response
|
|
427
413
|
else
|
|
428
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
414
|
+
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
|
|
429
415
|
end
|
|
430
416
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
431
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
417
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
432
418
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
433
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
419
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
434
420
|
else
|
|
435
|
-
if Utils.match_content_type(content_type,
|
|
421
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
436
422
|
http_response = @sdk_configuration.hooks.after_success(
|
|
437
423
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
438
424
|
hook_ctx: hook_ctx
|
|
@@ -450,7 +436,7 @@ module FastpixClient
|
|
|
450
436
|
|
|
451
437
|
return response
|
|
452
438
|
else
|
|
453
|
-
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
|
|
454
440
|
end
|
|
455
441
|
end
|
|
456
442
|
end
|
|
@@ -475,24 +461,16 @@ module FastpixClient
|
|
|
475
461
|
url = Utils.generate_url(
|
|
476
462
|
Models::Operations::UpdateAPlaylistRequest,
|
|
477
463
|
base_url,
|
|
478
|
-
|
|
464
|
+
PLAYLIST_PATH,
|
|
479
465
|
request
|
|
480
466
|
)
|
|
481
467
|
headers = {}
|
|
482
468
|
headers = T.cast(headers, T::Hash[String, String])
|
|
483
469
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
484
|
-
headers[
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
body = Utils.encode_form(form)
|
|
489
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
490
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
491
|
-
else
|
|
492
|
-
body = data
|
|
493
|
-
end
|
|
494
|
-
headers['Accept'] = 'application/json'
|
|
495
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
470
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
471
|
+
body = encode_request_body(req_content_type, data, form)
|
|
472
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
473
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
496
474
|
|
|
497
475
|
security = @sdk_configuration.security_source&.call
|
|
498
476
|
|
|
@@ -531,32 +509,12 @@ module FastpixClient
|
|
|
531
509
|
rescue StandardError => e
|
|
532
510
|
error = e
|
|
533
511
|
ensure
|
|
534
|
-
|
|
535
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
536
|
-
error: error,
|
|
537
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
538
|
-
hook_ctx: hook_ctx
|
|
539
|
-
),
|
|
540
|
-
response: http_response
|
|
541
|
-
)
|
|
542
|
-
else
|
|
543
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
544
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
545
|
-
hook_ctx: hook_ctx
|
|
546
|
-
),
|
|
547
|
-
response: http_response
|
|
548
|
-
)
|
|
549
|
-
end
|
|
550
|
-
|
|
551
|
-
if http_response.nil?
|
|
552
|
-
raise error if !error.nil?
|
|
553
|
-
raise 'no response'
|
|
554
|
-
end
|
|
512
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
555
513
|
end
|
|
556
514
|
|
|
557
|
-
content_type = http_response.headers.fetch(
|
|
515
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
558
516
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
559
|
-
if Utils.match_content_type(content_type,
|
|
517
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
560
518
|
http_response = @sdk_configuration.hooks.after_success(
|
|
561
519
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
562
520
|
hook_ctx: hook_ctx
|
|
@@ -574,14 +532,14 @@ module FastpixClient
|
|
|
574
532
|
|
|
575
533
|
return response
|
|
576
534
|
else
|
|
577
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
535
|
+
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
|
|
578
536
|
end
|
|
579
537
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
580
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
538
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
581
539
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
582
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
540
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
583
541
|
else
|
|
584
|
-
if Utils.match_content_type(content_type,
|
|
542
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
585
543
|
http_response = @sdk_configuration.hooks.after_success(
|
|
586
544
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
587
545
|
hook_ctx: hook_ctx
|
|
@@ -599,7 +557,7 @@ module FastpixClient
|
|
|
599
557
|
|
|
600
558
|
return response
|
|
601
559
|
else
|
|
602
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
560
|
+
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
|
|
603
561
|
end
|
|
604
562
|
end
|
|
605
563
|
end
|
|
@@ -622,13 +580,13 @@ module FastpixClient
|
|
|
622
580
|
url = Utils.generate_url(
|
|
623
581
|
Models::Operations::DeleteAPlaylistRequest,
|
|
624
582
|
base_url,
|
|
625
|
-
|
|
583
|
+
PLAYLIST_PATH,
|
|
626
584
|
request
|
|
627
585
|
)
|
|
628
586
|
headers = {}
|
|
629
587
|
headers = T.cast(headers, T::Hash[String, String])
|
|
630
|
-
headers['Accept'] =
|
|
631
|
-
headers[
|
|
588
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
589
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
632
590
|
|
|
633
591
|
security = @sdk_configuration.security_source&.call
|
|
634
592
|
|
|
@@ -666,32 +624,12 @@ module FastpixClient
|
|
|
666
624
|
rescue StandardError => e
|
|
667
625
|
error = e
|
|
668
626
|
ensure
|
|
669
|
-
|
|
670
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
671
|
-
error: error,
|
|
672
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
673
|
-
hook_ctx: hook_ctx
|
|
674
|
-
),
|
|
675
|
-
response: http_response
|
|
676
|
-
)
|
|
677
|
-
else
|
|
678
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
679
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
680
|
-
hook_ctx: hook_ctx
|
|
681
|
-
),
|
|
682
|
-
response: http_response
|
|
683
|
-
)
|
|
684
|
-
end
|
|
685
|
-
|
|
686
|
-
if http_response.nil?
|
|
687
|
-
raise error if !error.nil?
|
|
688
|
-
raise 'no response'
|
|
689
|
-
end
|
|
627
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
690
628
|
end
|
|
691
629
|
|
|
692
|
-
content_type = http_response.headers.fetch(
|
|
630
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
693
631
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
694
|
-
if Utils.match_content_type(content_type,
|
|
632
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
695
633
|
http_response = @sdk_configuration.hooks.after_success(
|
|
696
634
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
697
635
|
hook_ctx: hook_ctx
|
|
@@ -709,14 +647,14 @@ module FastpixClient
|
|
|
709
647
|
|
|
710
648
|
return response
|
|
711
649
|
else
|
|
712
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
650
|
+
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
|
|
713
651
|
end
|
|
714
652
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
715
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
653
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
716
654
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
717
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
655
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
718
656
|
else
|
|
719
|
-
if Utils.match_content_type(content_type,
|
|
657
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
720
658
|
http_response = @sdk_configuration.hooks.after_success(
|
|
721
659
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
722
660
|
hook_ctx: hook_ctx
|
|
@@ -734,7 +672,7 @@ module FastpixClient
|
|
|
734
672
|
|
|
735
673
|
return response
|
|
736
674
|
else
|
|
737
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
675
|
+
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
|
|
738
676
|
end
|
|
739
677
|
end
|
|
740
678
|
end
|
|
@@ -759,24 +697,16 @@ module FastpixClient
|
|
|
759
697
|
url = Utils.generate_url(
|
|
760
698
|
Models::Operations::AddMediaToPlaylistRequest,
|
|
761
699
|
base_url,
|
|
762
|
-
|
|
700
|
+
PLAYLIST_MEDIA_PATH,
|
|
763
701
|
request
|
|
764
702
|
)
|
|
765
703
|
headers = {}
|
|
766
704
|
headers = T.cast(headers, T::Hash[String, String])
|
|
767
705
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
768
|
-
headers[
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
body = Utils.encode_form(form)
|
|
773
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
774
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
775
|
-
else
|
|
776
|
-
body = data
|
|
777
|
-
end
|
|
778
|
-
headers['Accept'] = 'application/json'
|
|
779
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
706
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
707
|
+
body = encode_request_body(req_content_type, data, form)
|
|
708
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
709
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
780
710
|
|
|
781
711
|
security = @sdk_configuration.security_source&.call
|
|
782
712
|
|
|
@@ -815,32 +745,12 @@ module FastpixClient
|
|
|
815
745
|
rescue StandardError => e
|
|
816
746
|
error = e
|
|
817
747
|
ensure
|
|
818
|
-
|
|
819
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
820
|
-
error: error,
|
|
821
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
822
|
-
hook_ctx: hook_ctx
|
|
823
|
-
),
|
|
824
|
-
response: http_response
|
|
825
|
-
)
|
|
826
|
-
else
|
|
827
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
828
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
829
|
-
hook_ctx: hook_ctx
|
|
830
|
-
),
|
|
831
|
-
response: http_response
|
|
832
|
-
)
|
|
833
|
-
end
|
|
834
|
-
|
|
835
|
-
if http_response.nil?
|
|
836
|
-
raise error if !error.nil?
|
|
837
|
-
raise 'no response'
|
|
838
|
-
end
|
|
748
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
839
749
|
end
|
|
840
750
|
|
|
841
|
-
content_type = http_response.headers.fetch(
|
|
751
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
842
752
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
843
|
-
if Utils.match_content_type(content_type,
|
|
753
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
844
754
|
http_response = @sdk_configuration.hooks.after_success(
|
|
845
755
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
846
756
|
hook_ctx: hook_ctx
|
|
@@ -858,14 +768,14 @@ module FastpixClient
|
|
|
858
768
|
|
|
859
769
|
return response
|
|
860
770
|
else
|
|
861
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
771
|
+
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
|
|
862
772
|
end
|
|
863
773
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
864
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
774
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
865
775
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
866
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
776
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
867
777
|
else
|
|
868
|
-
if Utils.match_content_type(content_type,
|
|
778
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
869
779
|
http_response = @sdk_configuration.hooks.after_success(
|
|
870
780
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
871
781
|
hook_ctx: hook_ctx
|
|
@@ -883,7 +793,7 @@ module FastpixClient
|
|
|
883
793
|
|
|
884
794
|
return response
|
|
885
795
|
else
|
|
886
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
796
|
+
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
|
|
887
797
|
end
|
|
888
798
|
end
|
|
889
799
|
end
|
|
@@ -908,24 +818,16 @@ module FastpixClient
|
|
|
908
818
|
url = Utils.generate_url(
|
|
909
819
|
Models::Operations::ChangeMediaOrderInPlaylistRequest,
|
|
910
820
|
base_url,
|
|
911
|
-
|
|
821
|
+
PLAYLIST_MEDIA_PATH,
|
|
912
822
|
request
|
|
913
823
|
)
|
|
914
824
|
headers = {}
|
|
915
825
|
headers = T.cast(headers, T::Hash[String, String])
|
|
916
826
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
917
|
-
headers[
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
body = Utils.encode_form(form)
|
|
922
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
923
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
924
|
-
else
|
|
925
|
-
body = data
|
|
926
|
-
end
|
|
927
|
-
headers['Accept'] = 'application/json'
|
|
928
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
827
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
828
|
+
body = encode_request_body(req_content_type, data, form)
|
|
829
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
830
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
929
831
|
|
|
930
832
|
security = @sdk_configuration.security_source&.call
|
|
931
833
|
|
|
@@ -964,32 +866,12 @@ module FastpixClient
|
|
|
964
866
|
rescue StandardError => e
|
|
965
867
|
error = e
|
|
966
868
|
ensure
|
|
967
|
-
|
|
968
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
969
|
-
error: error,
|
|
970
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
971
|
-
hook_ctx: hook_ctx
|
|
972
|
-
),
|
|
973
|
-
response: http_response
|
|
974
|
-
)
|
|
975
|
-
else
|
|
976
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
977
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
978
|
-
hook_ctx: hook_ctx
|
|
979
|
-
),
|
|
980
|
-
response: http_response
|
|
981
|
-
)
|
|
982
|
-
end
|
|
983
|
-
|
|
984
|
-
if http_response.nil?
|
|
985
|
-
raise error if !error.nil?
|
|
986
|
-
raise 'no response'
|
|
987
|
-
end
|
|
869
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
988
870
|
end
|
|
989
871
|
|
|
990
|
-
content_type = http_response.headers.fetch(
|
|
872
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
991
873
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
992
|
-
if Utils.match_content_type(content_type,
|
|
874
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
993
875
|
http_response = @sdk_configuration.hooks.after_success(
|
|
994
876
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
995
877
|
hook_ctx: hook_ctx
|
|
@@ -1007,14 +889,14 @@ module FastpixClient
|
|
|
1007
889
|
|
|
1008
890
|
return response
|
|
1009
891
|
else
|
|
1010
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
892
|
+
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
|
|
1011
893
|
end
|
|
1012
894
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1013
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
895
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1014
896
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1015
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
897
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1016
898
|
else
|
|
1017
|
-
if Utils.match_content_type(content_type,
|
|
899
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1018
900
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1019
901
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1020
902
|
hook_ctx: hook_ctx
|
|
@@ -1032,7 +914,7 @@ module FastpixClient
|
|
|
1032
914
|
|
|
1033
915
|
return response
|
|
1034
916
|
else
|
|
1035
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
917
|
+
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
|
|
1036
918
|
end
|
|
1037
919
|
end
|
|
1038
920
|
end
|
|
@@ -1057,24 +939,16 @@ module FastpixClient
|
|
|
1057
939
|
url = Utils.generate_url(
|
|
1058
940
|
Models::Operations::DeleteMediaFromPlaylistRequest,
|
|
1059
941
|
base_url,
|
|
1060
|
-
|
|
942
|
+
PLAYLIST_MEDIA_PATH,
|
|
1061
943
|
request
|
|
1062
944
|
)
|
|
1063
945
|
headers = {}
|
|
1064
946
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1065
947
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
1066
|
-
headers[
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
body = Utils.encode_form(form)
|
|
1071
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1072
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1073
|
-
else
|
|
1074
|
-
body = data
|
|
1075
|
-
end
|
|
1076
|
-
headers['Accept'] = 'application/json'
|
|
1077
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
948
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
949
|
+
body = encode_request_body(req_content_type, data, form)
|
|
950
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
951
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1078
952
|
|
|
1079
953
|
security = @sdk_configuration.security_source&.call
|
|
1080
954
|
|
|
@@ -1113,32 +987,12 @@ module FastpixClient
|
|
|
1113
987
|
rescue StandardError => e
|
|
1114
988
|
error = e
|
|
1115
989
|
ensure
|
|
1116
|
-
|
|
1117
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1118
|
-
error: error,
|
|
1119
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1120
|
-
hook_ctx: hook_ctx
|
|
1121
|
-
),
|
|
1122
|
-
response: http_response
|
|
1123
|
-
)
|
|
1124
|
-
else
|
|
1125
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1126
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1127
|
-
hook_ctx: hook_ctx
|
|
1128
|
-
),
|
|
1129
|
-
response: http_response
|
|
1130
|
-
)
|
|
1131
|
-
end
|
|
1132
|
-
|
|
1133
|
-
if http_response.nil?
|
|
1134
|
-
raise error if !error.nil?
|
|
1135
|
-
raise 'no response'
|
|
1136
|
-
end
|
|
990
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1137
991
|
end
|
|
1138
992
|
|
|
1139
|
-
content_type = http_response.headers.fetch(
|
|
993
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1140
994
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1141
|
-
if Utils.match_content_type(content_type,
|
|
995
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1142
996
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1143
997
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1144
998
|
hook_ctx: hook_ctx
|
|
@@ -1156,14 +1010,14 @@ module FastpixClient
|
|
|
1156
1010
|
|
|
1157
1011
|
return response
|
|
1158
1012
|
else
|
|
1159
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1013
|
+
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
|
|
1160
1014
|
end
|
|
1161
1015
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1162
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1016
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1163
1017
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1164
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1018
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1165
1019
|
else
|
|
1166
|
-
if Utils.match_content_type(content_type,
|
|
1020
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1167
1021
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1168
1022
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1169
1023
|
hook_ctx: hook_ctx
|
|
@@ -1181,7 +1035,7 @@ module FastpixClient
|
|
|
1181
1035
|
|
|
1182
1036
|
return response
|
|
1183
1037
|
else
|
|
1184
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1038
|
+
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
|
|
1185
1039
|
end
|
|
1186
1040
|
end
|
|
1187
1041
|
end
|