fastpixapi 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +54 -61
- data/lib/fastpix_client/drm_configurations.rb +49 -56
- 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 +70 -77
- data/lib/fastpix_client/live_playback.rb +82 -99
- data/lib/fastpix_client/manage_live_stream.rb +149 -264
- data/lib/fastpix_client/manage_videos.rb +249 -566
- data/lib/fastpix_client/metrics.rb +79 -123
- data/lib/fastpix_client/models/components/addtrackrequest.rb +6 -2
- data/lib/fastpix_client/models/components/addtrackrequest.rbi +2 -0
- data/lib/fastpix_client/models/components/addtrackresponse.rb +6 -2
- data/lib/fastpix_client/models/components/addtrackresponse.rbi +2 -0
- data/lib/fastpix_client/models/components/audiotrack.rb +6 -2
- data/lib/fastpix_client/models/components/audiotrack.rbi +2 -0
- data/lib/fastpix_client/models/components/createlivestreamresponsedto.rb +10 -18
- data/lib/fastpix_client/models/components/createmediarequest.rb +9 -18
- data/lib/fastpix_client/models/components/generatetrackresponse.rb +6 -2
- data/lib/fastpix_client/models/components/generatetrackresponse.rbi +2 -0
- data/lib/fastpix_client/models/components/getallmediaresponse.rb +20 -38
- data/lib/fastpix_client/models/components/getallmediaresponse.rbi +2 -0
- data/lib/fastpix_client/models/components/getallmediaresponse_mp4support.rb +32 -12
- data/lib/fastpix_client/models/components/getallmediaresponse_mp4support.rbi +11 -1
- data/lib/fastpix_client/models/components/getallmediaresponse_sourceresolution.rb +2 -0
- data/lib/fastpix_client/models/components/getcreatelivestreamresponsedto.rb +9 -20
- data/lib/fastpix_client/models/components/{getmediaresponse.rb → getmediadetailresponse.rb} +25 -43
- data/lib/fastpix_client/models/components/{getmediaresponse.rbi → getmediadetailresponse.rbi} +4 -2
- data/lib/fastpix_client/models/components/{getmediaresponse_maxresolution.rb → getmediadetailresponse_maxresolution.rb} +2 -2
- data/lib/fastpix_client/models/components/getmediadetailresponse_maxresolution.rbi +11 -0
- data/lib/fastpix_client/models/components/{getmediaresponse_mediaquality.rb → getmediadetailresponse_mediaquality.rb} +2 -2
- data/lib/fastpix_client/models/components/getmediadetailresponse_mediaquality.rbi +11 -0
- data/lib/fastpix_client/models/components/getmediadetailresponse_mp4support.rb +48 -0
- data/lib/fastpix_client/models/components/getmediadetailresponse_mp4support.rbi +21 -0
- data/lib/fastpix_client/models/components/{getmediaresponse_sourceresolution.rb → getmediadetailresponse_sourceresolution.rb} +4 -2
- data/lib/fastpix_client/models/components/getmediadetailresponse_sourceresolution.rbi +11 -0
- data/lib/fastpix_client/models/components/{getmediaresponse_status.rb → getmediadetailresponse_status.rb} +2 -2
- data/lib/fastpix_client/models/components/getmediadetailresponse_status.rbi +11 -0
- data/lib/fastpix_client/models/components/{getmediaresponse_track.rb → getmediadetailresponse_track.rb} +1 -1
- data/lib/fastpix_client/models/components/getmediadetailresponse_track.rbi +11 -0
- data/lib/fastpix_client/models/components/live_media_clips.rb +16 -30
- data/lib/fastpix_client/models/components/live_media_clips.rbi +2 -0
- data/lib/fastpix_client/models/components/live_media_clips_mp4support.rb +32 -12
- data/lib/fastpix_client/models/components/live_media_clips_mp4support.rbi +11 -1
- data/lib/fastpix_client/models/components/live_media_clips_sourceresolution.rb +2 -0
- data/lib/fastpix_client/models/components/media.rb +18 -35
- data/lib/fastpix_client/models/components/media.rbi +2 -0
- data/lib/fastpix_client/models/components/media_mp4support.rb +32 -12
- data/lib/fastpix_client/models/components/media_mp4support.rbi +11 -1
- data/lib/fastpix_client/models/components/media_sourceresolution.rb +2 -0
- data/lib/fastpix_client/models/components/patchresponsedata.rb +9 -18
- data/lib/fastpix_client/models/components/sourceaccessmedia.rb +18 -35
- data/lib/fastpix_client/models/components/sourceaccessmedia.rbi +2 -0
- data/lib/fastpix_client/models/components/sourceaccessmedia_mp4support.rb +32 -12
- data/lib/fastpix_client/models/components/sourceaccessmedia_mp4support.rbi +11 -1
- data/lib/fastpix_client/models/components/sourceaccessmedia_sourceresolution.rb +2 -0
- data/lib/fastpix_client/models/components/subtitletrack.rb +6 -2
- data/lib/fastpix_client/models/components/subtitletrack.rbi +2 -0
- data/lib/fastpix_client/models/components/tracksubtitlesgeneraterequest.rb +6 -2
- data/lib/fastpix_client/models/components/tracksubtitlesgeneraterequest.rbi +2 -0
- data/lib/fastpix_client/models/components/update_media.rb +18 -35
- data/lib/fastpix_client/models/components/update_media.rbi +2 -0
- data/lib/fastpix_client/models/components/update_media_maxresolution.rb +0 -1
- data/lib/fastpix_client/models/components/update_media_mp4support.rb +32 -12
- data/lib/fastpix_client/models/components/update_media_mp4support.rbi +11 -1
- data/lib/fastpix_client/models/components/updatetrackrequest.rb +7 -7
- data/lib/fastpix_client/models/components/updatetrackrequest.rbi +2 -2
- data/lib/fastpix_client/models/components/updatetrackresponse.rb +6 -2
- data/lib/fastpix_client/models/components/updatetrackresponse.rbi +2 -0
- data/lib/fastpix_client/models/components/videotrack.rb +6 -2
- data/lib/fastpix_client/models/components/videotrack.rbi +2 -0
- data/lib/fastpix_client/models/components/videotrackforgetall.rb +6 -2
- data/lib/fastpix_client/models/components/videotrackforgetall.rbi +2 -0
- data/lib/fastpix_client/models/components/views.rb +51 -124
- data/lib/fastpix_client/models/components.rb +7 -7
- 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/get_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_responsebody.rb +2 -2
- data/lib/fastpix_client/models/operations/push_media_settings.rb +9 -20
- data/lib/fastpix_client/playback.rb +122 -213
- data/lib/fastpix_client/playlist.rb +152 -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 +3 -3
- data/lib/fastpix_client/signing_keys.rb +76 -120
- data/lib/fastpix_client/simulcast_stream.rb +100 -144
- data/lib/fastpix_client/start_live_stream.rb +55 -37
- 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 -60
- data/lib/fastpix_client/utils/utils.rb +19 -37
- data/lib/fastpix_client/views.rb +69 -93
- data/lib/fastpixapi.rb +10 -10
- data/lib/openssl_patch.rb +24 -24
- metadata +17 -18
- data/lib/fastpix_client/models/components/getmediaresponse_maxresolution.rbi +0 -11
- data/lib/fastpix_client/models/components/getmediaresponse_mediaquality.rbi +0 -11
- data/lib/fastpix_client/models/components/getmediaresponse_mp4support.rb +0 -28
- data/lib/fastpix_client/models/components/getmediaresponse_mp4support.rbi +0 -11
- data/lib/fastpix_client/models/components/getmediaresponse_sourceresolution.rbi +0 -11
- data/lib/fastpix_client/models/components/getmediaresponse_status.rbi +0 -11
- data/lib/fastpix_client/models/components/getmediaresponse_track.rbi +0 -11
- data/test/sdk_examples_test.rb +0 -20
- data/test/test_helper.rb +0 -29
|
@@ -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,8 @@ 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://fastpix.com/docs/
|
|
104
|
+
# For more details, see <a href="https://fastpix.com/docs/video-on-demand/create-and-manage-playlists">Create and manage playlist</a>.
|
|
105
|
+
|
|
51
106
|
#
|
|
52
107
|
# #### How it works
|
|
53
108
|
#
|
|
@@ -63,18 +118,10 @@ module FastpixClient
|
|
|
63
118
|
headers = {}
|
|
64
119
|
headers = T.cast(headers, T::Hash[String, String])
|
|
65
120
|
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
|
|
121
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
122
|
+
body = encode_request_body(req_content_type, data, form)
|
|
123
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
124
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
78
125
|
|
|
79
126
|
security = @sdk_configuration.security_source&.call
|
|
80
127
|
|
|
@@ -113,32 +160,12 @@ module FastpixClient
|
|
|
113
160
|
rescue StandardError => e
|
|
114
161
|
error = e
|
|
115
162
|
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
|
|
163
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
137
164
|
end
|
|
138
165
|
|
|
139
|
-
content_type = http_response.headers.fetch(
|
|
166
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
140
167
|
if Utils.match_status_code(http_response.status, ['201'])
|
|
141
|
-
if Utils.match_content_type(content_type,
|
|
168
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
142
169
|
http_response = @sdk_configuration.hooks.after_success(
|
|
143
170
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
144
171
|
hook_ctx: hook_ctx
|
|
@@ -156,14 +183,14 @@ module FastpixClient
|
|
|
156
183
|
|
|
157
184
|
return response
|
|
158
185
|
else
|
|
159
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
186
|
+
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
187
|
end
|
|
161
188
|
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),
|
|
189
|
+
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
190
|
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),
|
|
191
|
+
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
192
|
else
|
|
166
|
-
if Utils.match_content_type(content_type,
|
|
193
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
167
194
|
http_response = @sdk_configuration.hooks.after_success(
|
|
168
195
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
169
196
|
hook_ctx: hook_ctx
|
|
@@ -181,7 +208,7 @@ module FastpixClient
|
|
|
181
208
|
|
|
182
209
|
return response
|
|
183
210
|
else
|
|
184
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
211
|
+
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
212
|
end
|
|
186
213
|
end
|
|
187
214
|
end
|
|
@@ -208,8 +235,8 @@ module FastpixClient
|
|
|
208
235
|
headers = {}
|
|
209
236
|
headers = T.cast(headers, T::Hash[String, String])
|
|
210
237
|
query_params = Utils.get_query_params(Models::Operations::GetAllPlaylistsRequest, request, nil)
|
|
211
|
-
headers['Accept'] =
|
|
212
|
-
headers[
|
|
238
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
239
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
213
240
|
|
|
214
241
|
security = @sdk_configuration.security_source&.call
|
|
215
242
|
|
|
@@ -248,32 +275,12 @@ module FastpixClient
|
|
|
248
275
|
rescue StandardError => e
|
|
249
276
|
error = e
|
|
250
277
|
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
|
|
278
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
272
279
|
end
|
|
273
280
|
|
|
274
|
-
content_type = http_response.headers.fetch(
|
|
281
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
275
282
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
276
|
-
if Utils.match_content_type(content_type,
|
|
283
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
277
284
|
http_response = @sdk_configuration.hooks.after_success(
|
|
278
285
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
279
286
|
hook_ctx: hook_ctx
|
|
@@ -291,14 +298,14 @@ module FastpixClient
|
|
|
291
298
|
|
|
292
299
|
return response
|
|
293
300
|
else
|
|
294
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
301
|
+
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
302
|
end
|
|
296
303
|
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),
|
|
304
|
+
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
305
|
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),
|
|
306
|
+
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
307
|
else
|
|
301
|
-
if Utils.match_content_type(content_type,
|
|
308
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
302
309
|
http_response = @sdk_configuration.hooks.after_success(
|
|
303
310
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
304
311
|
hook_ctx: hook_ctx
|
|
@@ -316,7 +323,7 @@ module FastpixClient
|
|
|
316
323
|
|
|
317
324
|
return response
|
|
318
325
|
else
|
|
319
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
326
|
+
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
327
|
end
|
|
321
328
|
end
|
|
322
329
|
end
|
|
@@ -338,13 +345,13 @@ module FastpixClient
|
|
|
338
345
|
url = Utils.generate_url(
|
|
339
346
|
Models::Operations::GetPlaylistByIdRequest,
|
|
340
347
|
base_url,
|
|
341
|
-
|
|
348
|
+
PLAYLIST_PATH,
|
|
342
349
|
request
|
|
343
350
|
)
|
|
344
351
|
headers = {}
|
|
345
352
|
headers = T.cast(headers, T::Hash[String, String])
|
|
346
|
-
headers['Accept'] =
|
|
347
|
-
headers[
|
|
353
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
354
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
348
355
|
|
|
349
356
|
security = @sdk_configuration.security_source&.call
|
|
350
357
|
|
|
@@ -382,32 +389,12 @@ module FastpixClient
|
|
|
382
389
|
rescue StandardError => e
|
|
383
390
|
error = e
|
|
384
391
|
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
|
|
392
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
406
393
|
end
|
|
407
394
|
|
|
408
|
-
content_type = http_response.headers.fetch(
|
|
395
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
409
396
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
410
|
-
if Utils.match_content_type(content_type,
|
|
397
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
411
398
|
http_response = @sdk_configuration.hooks.after_success(
|
|
412
399
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
413
400
|
hook_ctx: hook_ctx
|
|
@@ -425,14 +412,14 @@ module FastpixClient
|
|
|
425
412
|
|
|
426
413
|
return response
|
|
427
414
|
else
|
|
428
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
415
|
+
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
416
|
end
|
|
430
417
|
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),
|
|
418
|
+
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
419
|
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),
|
|
420
|
+
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
421
|
else
|
|
435
|
-
if Utils.match_content_type(content_type,
|
|
422
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
436
423
|
http_response = @sdk_configuration.hooks.after_success(
|
|
437
424
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
438
425
|
hook_ctx: hook_ctx
|
|
@@ -450,7 +437,7 @@ module FastpixClient
|
|
|
450
437
|
|
|
451
438
|
return response
|
|
452
439
|
else
|
|
453
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
440
|
+
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
441
|
end
|
|
455
442
|
end
|
|
456
443
|
end
|
|
@@ -475,24 +462,16 @@ module FastpixClient
|
|
|
475
462
|
url = Utils.generate_url(
|
|
476
463
|
Models::Operations::UpdateAPlaylistRequest,
|
|
477
464
|
base_url,
|
|
478
|
-
|
|
465
|
+
PLAYLIST_PATH,
|
|
479
466
|
request
|
|
480
467
|
)
|
|
481
468
|
headers = {}
|
|
482
469
|
headers = T.cast(headers, T::Hash[String, String])
|
|
483
470
|
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
|
|
471
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
472
|
+
body = encode_request_body(req_content_type, data, form)
|
|
473
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
474
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
496
475
|
|
|
497
476
|
security = @sdk_configuration.security_source&.call
|
|
498
477
|
|
|
@@ -531,32 +510,12 @@ module FastpixClient
|
|
|
531
510
|
rescue StandardError => e
|
|
532
511
|
error = e
|
|
533
512
|
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
|
|
513
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
555
514
|
end
|
|
556
515
|
|
|
557
|
-
content_type = http_response.headers.fetch(
|
|
516
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
558
517
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
559
|
-
if Utils.match_content_type(content_type,
|
|
518
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
560
519
|
http_response = @sdk_configuration.hooks.after_success(
|
|
561
520
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
562
521
|
hook_ctx: hook_ctx
|
|
@@ -574,14 +533,14 @@ module FastpixClient
|
|
|
574
533
|
|
|
575
534
|
return response
|
|
576
535
|
else
|
|
577
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
536
|
+
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
537
|
end
|
|
579
538
|
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),
|
|
539
|
+
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
540
|
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),
|
|
541
|
+
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
542
|
else
|
|
584
|
-
if Utils.match_content_type(content_type,
|
|
543
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
585
544
|
http_response = @sdk_configuration.hooks.after_success(
|
|
586
545
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
587
546
|
hook_ctx: hook_ctx
|
|
@@ -599,7 +558,7 @@ module FastpixClient
|
|
|
599
558
|
|
|
600
559
|
return response
|
|
601
560
|
else
|
|
602
|
-
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), UNKNOWN_CONTENT_TYPE_ERROR
|
|
603
562
|
end
|
|
604
563
|
end
|
|
605
564
|
end
|
|
@@ -622,13 +581,13 @@ module FastpixClient
|
|
|
622
581
|
url = Utils.generate_url(
|
|
623
582
|
Models::Operations::DeleteAPlaylistRequest,
|
|
624
583
|
base_url,
|
|
625
|
-
|
|
584
|
+
PLAYLIST_PATH,
|
|
626
585
|
request
|
|
627
586
|
)
|
|
628
587
|
headers = {}
|
|
629
588
|
headers = T.cast(headers, T::Hash[String, String])
|
|
630
|
-
headers['Accept'] =
|
|
631
|
-
headers[
|
|
589
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
590
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
632
591
|
|
|
633
592
|
security = @sdk_configuration.security_source&.call
|
|
634
593
|
|
|
@@ -666,32 +625,12 @@ module FastpixClient
|
|
|
666
625
|
rescue StandardError => e
|
|
667
626
|
error = e
|
|
668
627
|
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
|
|
628
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
690
629
|
end
|
|
691
630
|
|
|
692
|
-
content_type = http_response.headers.fetch(
|
|
631
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
693
632
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
694
|
-
if Utils.match_content_type(content_type,
|
|
633
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
695
634
|
http_response = @sdk_configuration.hooks.after_success(
|
|
696
635
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
697
636
|
hook_ctx: hook_ctx
|
|
@@ -709,14 +648,14 @@ module FastpixClient
|
|
|
709
648
|
|
|
710
649
|
return response
|
|
711
650
|
else
|
|
712
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
651
|
+
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
652
|
end
|
|
714
653
|
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),
|
|
654
|
+
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
655
|
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),
|
|
656
|
+
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
657
|
else
|
|
719
|
-
if Utils.match_content_type(content_type,
|
|
658
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
720
659
|
http_response = @sdk_configuration.hooks.after_success(
|
|
721
660
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
722
661
|
hook_ctx: hook_ctx
|
|
@@ -734,7 +673,7 @@ module FastpixClient
|
|
|
734
673
|
|
|
735
674
|
return response
|
|
736
675
|
else
|
|
737
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
676
|
+
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
677
|
end
|
|
739
678
|
end
|
|
740
679
|
end
|
|
@@ -759,24 +698,16 @@ module FastpixClient
|
|
|
759
698
|
url = Utils.generate_url(
|
|
760
699
|
Models::Operations::AddMediaToPlaylistRequest,
|
|
761
700
|
base_url,
|
|
762
|
-
|
|
701
|
+
PLAYLIST_MEDIA_PATH,
|
|
763
702
|
request
|
|
764
703
|
)
|
|
765
704
|
headers = {}
|
|
766
705
|
headers = T.cast(headers, T::Hash[String, String])
|
|
767
706
|
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
|
|
707
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
708
|
+
body = encode_request_body(req_content_type, data, form)
|
|
709
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
710
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
780
711
|
|
|
781
712
|
security = @sdk_configuration.security_source&.call
|
|
782
713
|
|
|
@@ -815,32 +746,12 @@ module FastpixClient
|
|
|
815
746
|
rescue StandardError => e
|
|
816
747
|
error = e
|
|
817
748
|
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
|
|
749
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
839
750
|
end
|
|
840
751
|
|
|
841
|
-
content_type = http_response.headers.fetch(
|
|
752
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
842
753
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
843
|
-
if Utils.match_content_type(content_type,
|
|
754
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
844
755
|
http_response = @sdk_configuration.hooks.after_success(
|
|
845
756
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
846
757
|
hook_ctx: hook_ctx
|
|
@@ -858,14 +769,14 @@ module FastpixClient
|
|
|
858
769
|
|
|
859
770
|
return response
|
|
860
771
|
else
|
|
861
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
772
|
+
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
773
|
end
|
|
863
774
|
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),
|
|
775
|
+
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
776
|
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),
|
|
777
|
+
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
778
|
else
|
|
868
|
-
if Utils.match_content_type(content_type,
|
|
779
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
869
780
|
http_response = @sdk_configuration.hooks.after_success(
|
|
870
781
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
871
782
|
hook_ctx: hook_ctx
|
|
@@ -883,7 +794,7 @@ module FastpixClient
|
|
|
883
794
|
|
|
884
795
|
return response
|
|
885
796
|
else
|
|
886
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
797
|
+
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
798
|
end
|
|
888
799
|
end
|
|
889
800
|
end
|
|
@@ -908,24 +819,16 @@ module FastpixClient
|
|
|
908
819
|
url = Utils.generate_url(
|
|
909
820
|
Models::Operations::ChangeMediaOrderInPlaylistRequest,
|
|
910
821
|
base_url,
|
|
911
|
-
|
|
822
|
+
PLAYLIST_MEDIA_PATH,
|
|
912
823
|
request
|
|
913
824
|
)
|
|
914
825
|
headers = {}
|
|
915
826
|
headers = T.cast(headers, T::Hash[String, String])
|
|
916
827
|
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
|
|
828
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
829
|
+
body = encode_request_body(req_content_type, data, form)
|
|
830
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
831
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
929
832
|
|
|
930
833
|
security = @sdk_configuration.security_source&.call
|
|
931
834
|
|
|
@@ -964,32 +867,12 @@ module FastpixClient
|
|
|
964
867
|
rescue StandardError => e
|
|
965
868
|
error = e
|
|
966
869
|
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
|
|
870
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
988
871
|
end
|
|
989
872
|
|
|
990
|
-
content_type = http_response.headers.fetch(
|
|
873
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
991
874
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
992
|
-
if Utils.match_content_type(content_type,
|
|
875
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
993
876
|
http_response = @sdk_configuration.hooks.after_success(
|
|
994
877
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
995
878
|
hook_ctx: hook_ctx
|
|
@@ -1007,14 +890,14 @@ module FastpixClient
|
|
|
1007
890
|
|
|
1008
891
|
return response
|
|
1009
892
|
else
|
|
1010
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
893
|
+
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
894
|
end
|
|
1012
895
|
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),
|
|
896
|
+
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
897
|
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),
|
|
898
|
+
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
899
|
else
|
|
1017
|
-
if Utils.match_content_type(content_type,
|
|
900
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1018
901
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1019
902
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1020
903
|
hook_ctx: hook_ctx
|
|
@@ -1032,7 +915,7 @@ module FastpixClient
|
|
|
1032
915
|
|
|
1033
916
|
return response
|
|
1034
917
|
else
|
|
1035
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
918
|
+
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
919
|
end
|
|
1037
920
|
end
|
|
1038
921
|
end
|
|
@@ -1057,24 +940,16 @@ module FastpixClient
|
|
|
1057
940
|
url = Utils.generate_url(
|
|
1058
941
|
Models::Operations::DeleteMediaFromPlaylistRequest,
|
|
1059
942
|
base_url,
|
|
1060
|
-
|
|
943
|
+
PLAYLIST_MEDIA_PATH,
|
|
1061
944
|
request
|
|
1062
945
|
)
|
|
1063
946
|
headers = {}
|
|
1064
947
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1065
948
|
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
|
|
949
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
950
|
+
body = encode_request_body(req_content_type, data, form)
|
|
951
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
952
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1078
953
|
|
|
1079
954
|
security = @sdk_configuration.security_source&.call
|
|
1080
955
|
|
|
@@ -1113,32 +988,12 @@ module FastpixClient
|
|
|
1113
988
|
rescue StandardError => e
|
|
1114
989
|
error = e
|
|
1115
990
|
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
|
|
991
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1137
992
|
end
|
|
1138
993
|
|
|
1139
|
-
content_type = http_response.headers.fetch(
|
|
994
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1140
995
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1141
|
-
if Utils.match_content_type(content_type,
|
|
996
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1142
997
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1143
998
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1144
999
|
hook_ctx: hook_ctx
|
|
@@ -1156,14 +1011,14 @@ module FastpixClient
|
|
|
1156
1011
|
|
|
1157
1012
|
return response
|
|
1158
1013
|
else
|
|
1159
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1014
|
+
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
1015
|
end
|
|
1161
1016
|
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),
|
|
1017
|
+
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
1018
|
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),
|
|
1019
|
+
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
1020
|
else
|
|
1166
|
-
if Utils.match_content_type(content_type,
|
|
1021
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1167
1022
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1168
1023
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1169
1024
|
hook_ctx: hook_ctx
|
|
@@ -1181,7 +1036,7 @@ module FastpixClient
|
|
|
1181
1036
|
|
|
1182
1037
|
return response
|
|
1183
1038
|
else
|
|
1184
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1039
|
+
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
1040
|
end
|
|
1186
1041
|
end
|
|
1187
1042
|
end
|