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,59 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class ManageVideos
|
|
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
|
+
MEDIA_PATH = '/on-demand/{mediaId}'
|
|
23
|
+
REQUEST_CONTENT_TYPE_HEADER = 'content-type'
|
|
24
|
+
UNKNOWN_CONTENT_TYPE_ERROR = 'Unknown content type received'
|
|
25
|
+
USER_AGENT_HEADER = 'user-agent'
|
|
26
|
+
|
|
27
|
+
# Applies the SDK after-request hooks and ensures a usable response is present.
|
|
28
|
+
sig { params(http_response: T.nilable(Faraday::Response), error: T.nilable(StandardError), hook_ctx: SDKHooks::HookContext).returns(Faraday::Response) }
|
|
29
|
+
def apply_after_request_hooks(http_response, error, hook_ctx)
|
|
30
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
31
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
32
|
+
error: error,
|
|
33
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
34
|
+
hook_ctx: hook_ctx
|
|
35
|
+
),
|
|
36
|
+
response: http_response
|
|
37
|
+
)
|
|
38
|
+
else
|
|
39
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
40
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
41
|
+
hook_ctx: hook_ctx
|
|
42
|
+
),
|
|
43
|
+
response: http_response
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
if http_response.nil?
|
|
48
|
+
raise error unless error.nil?
|
|
49
|
+
raise ::FastpixClient::Models::Errors::EmptyResponseError, 'no response'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
http_response
|
|
53
|
+
end
|
|
54
|
+
private :apply_after_request_hooks
|
|
55
|
+
|
|
56
|
+
# Encodes the request body based on its serialized content type.
|
|
57
|
+
sig { params(req_content_type: T.nilable(String), data: T.untyped, form: T.untyped).returns(T.untyped) }
|
|
58
|
+
def encode_request_body(req_content_type, data, form)
|
|
59
|
+
raise ArgumentError, 'request body is required' if data.nil? && form.nil?
|
|
60
|
+
|
|
61
|
+
if form
|
|
62
|
+
Utils.encode_form(form)
|
|
63
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
64
|
+
URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
65
|
+
else
|
|
66
|
+
data
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
private :encode_request_body
|
|
17
70
|
|
|
18
71
|
# Operations for managing video media
|
|
19
72
|
|
|
@@ -65,8 +118,8 @@ module FastpixClient
|
|
|
65
118
|
headers = {}
|
|
66
119
|
headers = T.cast(headers, T::Hash[String, String])
|
|
67
120
|
query_params = Utils.get_query_params(Models::Operations::ListMediaRequest, request, nil)
|
|
68
|
-
headers['Accept'] =
|
|
69
|
-
headers[
|
|
121
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
122
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
70
123
|
|
|
71
124
|
security = @sdk_configuration.security_source&.call
|
|
72
125
|
|
|
@@ -105,32 +158,12 @@ module FastpixClient
|
|
|
105
158
|
rescue StandardError => e
|
|
106
159
|
error = e
|
|
107
160
|
ensure
|
|
108
|
-
|
|
109
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
110
|
-
error: error,
|
|
111
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
112
|
-
hook_ctx: hook_ctx
|
|
113
|
-
),
|
|
114
|
-
response: http_response
|
|
115
|
-
)
|
|
116
|
-
else
|
|
117
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
118
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
119
|
-
hook_ctx: hook_ctx
|
|
120
|
-
),
|
|
121
|
-
response: http_response
|
|
122
|
-
)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
if http_response.nil?
|
|
126
|
-
raise error if !error.nil?
|
|
127
|
-
raise 'no response'
|
|
128
|
-
end
|
|
161
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
129
162
|
end
|
|
130
163
|
|
|
131
|
-
content_type = http_response.headers.fetch(
|
|
164
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
132
165
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
133
|
-
if Utils.match_content_type(content_type,
|
|
166
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
134
167
|
http_response = @sdk_configuration.hooks.after_success(
|
|
135
168
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
136
169
|
hook_ctx: hook_ctx
|
|
@@ -148,14 +181,14 @@ module FastpixClient
|
|
|
148
181
|
|
|
149
182
|
return response
|
|
150
183
|
else
|
|
151
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
184
|
+
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
|
|
152
185
|
end
|
|
153
186
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
154
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
187
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
155
188
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
156
|
-
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
|
|
157
190
|
else
|
|
158
|
-
if Utils.match_content_type(content_type,
|
|
191
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
159
192
|
http_response = @sdk_configuration.hooks.after_success(
|
|
160
193
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
161
194
|
hook_ctx: hook_ctx
|
|
@@ -173,7 +206,7 @@ module FastpixClient
|
|
|
173
206
|
|
|
174
207
|
return response
|
|
175
208
|
else
|
|
176
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
209
|
+
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
|
|
177
210
|
end
|
|
178
211
|
end
|
|
179
212
|
end
|
|
@@ -194,7 +227,7 @@ module FastpixClient
|
|
|
194
227
|
# Suppose you’re hosting a live gaming event and want to showcase key moments from the stream — such as top plays or final match highlights. You can use this endpoint to fetch all clips generated from that livestream, display them in your dashboard, or use them for post-event editing and sharing.
|
|
195
228
|
#
|
|
196
229
|
#
|
|
197
|
-
# Related guide: <a href="https://fastpix.com/docs/
|
|
230
|
+
# Related guide: <a href="https://fastpix.com/docs/live-streaming/clip-moments-from-a-live-stream">Instant live clipping</a>
|
|
198
231
|
#
|
|
199
232
|
request = Models::Operations::ListLiveClipsRequest.new(
|
|
200
233
|
livestream_id: livestream_id,
|
|
@@ -213,8 +246,8 @@ module FastpixClient
|
|
|
213
246
|
headers = {}
|
|
214
247
|
headers = T.cast(headers, T::Hash[String, String])
|
|
215
248
|
query_params = Utils.get_query_params(Models::Operations::ListLiveClipsRequest, request, nil)
|
|
216
|
-
headers['Accept'] =
|
|
217
|
-
headers[
|
|
249
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
250
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
218
251
|
|
|
219
252
|
security = @sdk_configuration.security_source&.call
|
|
220
253
|
|
|
@@ -253,32 +286,12 @@ module FastpixClient
|
|
|
253
286
|
rescue StandardError => e
|
|
254
287
|
error = e
|
|
255
288
|
ensure
|
|
256
|
-
|
|
257
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
258
|
-
error: error,
|
|
259
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
260
|
-
hook_ctx: hook_ctx
|
|
261
|
-
),
|
|
262
|
-
response: http_response
|
|
263
|
-
)
|
|
264
|
-
else
|
|
265
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
266
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
267
|
-
hook_ctx: hook_ctx
|
|
268
|
-
),
|
|
269
|
-
response: http_response
|
|
270
|
-
)
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
if http_response.nil?
|
|
274
|
-
raise error if !error.nil?
|
|
275
|
-
raise 'no response'
|
|
276
|
-
end
|
|
289
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
277
290
|
end
|
|
278
291
|
|
|
279
|
-
content_type = http_response.headers.fetch(
|
|
292
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
280
293
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
281
|
-
if Utils.match_content_type(content_type,
|
|
294
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
282
295
|
http_response = @sdk_configuration.hooks.after_success(
|
|
283
296
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
284
297
|
hook_ctx: hook_ctx
|
|
@@ -296,14 +309,14 @@ module FastpixClient
|
|
|
296
309
|
|
|
297
310
|
return response
|
|
298
311
|
else
|
|
299
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
312
|
+
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
|
|
300
313
|
end
|
|
301
314
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
302
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
315
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
303
316
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
304
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
317
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
305
318
|
else
|
|
306
|
-
if Utils.match_content_type(content_type,
|
|
319
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
307
320
|
http_response = @sdk_configuration.hooks.after_success(
|
|
308
321
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
309
322
|
hook_ctx: hook_ctx
|
|
@@ -321,7 +334,7 @@ module FastpixClient
|
|
|
321
334
|
|
|
322
335
|
return response
|
|
323
336
|
else
|
|
324
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
337
|
+
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
|
|
325
338
|
end
|
|
326
339
|
end
|
|
327
340
|
end
|
|
@@ -356,13 +369,13 @@ module FastpixClient
|
|
|
356
369
|
url = Utils.generate_url(
|
|
357
370
|
Models::Operations::GetMediaRequest,
|
|
358
371
|
base_url,
|
|
359
|
-
|
|
372
|
+
MEDIA_PATH,
|
|
360
373
|
request
|
|
361
374
|
)
|
|
362
375
|
headers = {}
|
|
363
376
|
headers = T.cast(headers, T::Hash[String, String])
|
|
364
|
-
headers['Accept'] =
|
|
365
|
-
headers[
|
|
377
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
378
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
366
379
|
|
|
367
380
|
security = @sdk_configuration.security_source&.call
|
|
368
381
|
|
|
@@ -400,32 +413,12 @@ module FastpixClient
|
|
|
400
413
|
rescue StandardError => e
|
|
401
414
|
error = e
|
|
402
415
|
ensure
|
|
403
|
-
|
|
404
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
405
|
-
error: error,
|
|
406
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
407
|
-
hook_ctx: hook_ctx
|
|
408
|
-
),
|
|
409
|
-
response: http_response
|
|
410
|
-
)
|
|
411
|
-
else
|
|
412
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
413
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
414
|
-
hook_ctx: hook_ctx
|
|
415
|
-
),
|
|
416
|
-
response: http_response
|
|
417
|
-
)
|
|
418
|
-
end
|
|
419
|
-
|
|
420
|
-
if http_response.nil?
|
|
421
|
-
raise error if !error.nil?
|
|
422
|
-
raise 'no response'
|
|
423
|
-
end
|
|
416
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
424
417
|
end
|
|
425
418
|
|
|
426
|
-
content_type = http_response.headers.fetch(
|
|
419
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
427
420
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
428
|
-
if Utils.match_content_type(content_type,
|
|
421
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
429
422
|
http_response = @sdk_configuration.hooks.after_success(
|
|
430
423
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
431
424
|
hook_ctx: hook_ctx
|
|
@@ -443,14 +436,14 @@ module FastpixClient
|
|
|
443
436
|
|
|
444
437
|
return response
|
|
445
438
|
else
|
|
446
|
-
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
|
|
447
440
|
end
|
|
448
441
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
449
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
442
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
450
443
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
451
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
444
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
452
445
|
else
|
|
453
|
-
if Utils.match_content_type(content_type,
|
|
446
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
454
447
|
http_response = @sdk_configuration.hooks.after_success(
|
|
455
448
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
456
449
|
hook_ctx: hook_ctx
|
|
@@ -468,7 +461,7 @@ module FastpixClient
|
|
|
468
461
|
|
|
469
462
|
return response
|
|
470
463
|
else
|
|
471
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
464
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
472
465
|
end
|
|
473
466
|
end
|
|
474
467
|
end
|
|
@@ -488,8 +481,7 @@ module FastpixClient
|
|
|
488
481
|
#
|
|
489
482
|
# 3. The response returns the updated media data, confirming the changes.
|
|
490
483
|
#
|
|
491
|
-
# 4. Monitor the <a href="https://fastpix.com/docs/
|
|
492
|
-
#
|
|
484
|
+
# 4. Monitor the <a href="https://fastpix.com/docs/webhooks/media-events#videomediaupdated">video.media.updated</a> webhook event to track the update status in your system.
|
|
493
485
|
# #### Example
|
|
494
486
|
# If a user uploads a video and later needs to change the title, add a new description, or update tags, you can use this endpoint to update the media metadata without re-uploading the entire video.
|
|
495
487
|
#
|
|
@@ -502,24 +494,16 @@ module FastpixClient
|
|
|
502
494
|
url = Utils.generate_url(
|
|
503
495
|
Models::Operations::UpdatedMediaRequest,
|
|
504
496
|
base_url,
|
|
505
|
-
|
|
497
|
+
MEDIA_PATH,
|
|
506
498
|
request
|
|
507
499
|
)
|
|
508
500
|
headers = {}
|
|
509
501
|
headers = T.cast(headers, T::Hash[String, String])
|
|
510
502
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
511
|
-
headers[
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
body = Utils.encode_form(form)
|
|
516
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
517
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
518
|
-
else
|
|
519
|
-
body = data
|
|
520
|
-
end
|
|
521
|
-
headers['Accept'] = 'application/json'
|
|
522
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
503
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
504
|
+
body = encode_request_body(req_content_type, data, form)
|
|
505
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
506
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
523
507
|
|
|
524
508
|
security = @sdk_configuration.security_source&.call
|
|
525
509
|
|
|
@@ -558,32 +542,12 @@ module FastpixClient
|
|
|
558
542
|
rescue StandardError => e
|
|
559
543
|
error = e
|
|
560
544
|
ensure
|
|
561
|
-
|
|
562
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
563
|
-
error: error,
|
|
564
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
565
|
-
hook_ctx: hook_ctx
|
|
566
|
-
),
|
|
567
|
-
response: http_response
|
|
568
|
-
)
|
|
569
|
-
else
|
|
570
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
571
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
572
|
-
hook_ctx: hook_ctx
|
|
573
|
-
),
|
|
574
|
-
response: http_response
|
|
575
|
-
)
|
|
576
|
-
end
|
|
577
|
-
|
|
578
|
-
if http_response.nil?
|
|
579
|
-
raise error if !error.nil?
|
|
580
|
-
raise 'no response'
|
|
581
|
-
end
|
|
545
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
582
546
|
end
|
|
583
547
|
|
|
584
|
-
content_type = http_response.headers.fetch(
|
|
548
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
585
549
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
586
|
-
if Utils.match_content_type(content_type,
|
|
550
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
587
551
|
http_response = @sdk_configuration.hooks.after_success(
|
|
588
552
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
589
553
|
hook_ctx: hook_ctx
|
|
@@ -601,14 +565,14 @@ module FastpixClient
|
|
|
601
565
|
|
|
602
566
|
return response
|
|
603
567
|
else
|
|
604
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
568
|
+
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
|
|
605
569
|
end
|
|
606
570
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
607
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
571
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
608
572
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
609
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
573
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
610
574
|
else
|
|
611
|
-
if Utils.match_content_type(content_type,
|
|
575
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
612
576
|
http_response = @sdk_configuration.hooks.after_success(
|
|
613
577
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
614
578
|
hook_ctx: hook_ctx
|
|
@@ -626,7 +590,7 @@ module FastpixClient
|
|
|
626
590
|
|
|
627
591
|
return response
|
|
628
592
|
else
|
|
629
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
593
|
+
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
|
|
630
594
|
end
|
|
631
595
|
end
|
|
632
596
|
end
|
|
@@ -645,7 +609,7 @@ module FastpixClient
|
|
|
645
609
|
#
|
|
646
610
|
# 2. This action is irreversible. Make sure you no longer need the media before proceeding. Once deleted, the media can’t be retrieved or played back.
|
|
647
611
|
#
|
|
648
|
-
# 3. Monitor the following webhook event: <a href="https://fastpix.com/docs/
|
|
612
|
+
# 3. Monitor the following webhook event: <a href="https://fastpix.com/docs/webhooks/media-events#videomediadeleted">video.media.deleted</a>
|
|
649
613
|
#
|
|
650
614
|
# #### Example
|
|
651
615
|
# A user on a video-sharing platform decides to remove an old video from their profile, or suppose you're running a content moderation system, and one of the videos uploaded by a user violates your platform's policies. Using this endpoint, the media is permanently deleted from your library, ensuring it's no longer accessible or viewable by other users.
|
|
@@ -658,13 +622,13 @@ module FastpixClient
|
|
|
658
622
|
url = Utils.generate_url(
|
|
659
623
|
Models::Operations::DeleteMediaRequest,
|
|
660
624
|
base_url,
|
|
661
|
-
|
|
625
|
+
MEDIA_PATH,
|
|
662
626
|
request
|
|
663
627
|
)
|
|
664
628
|
headers = {}
|
|
665
629
|
headers = T.cast(headers, T::Hash[String, String])
|
|
666
|
-
headers['Accept'] =
|
|
667
|
-
headers[
|
|
630
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
631
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
668
632
|
|
|
669
633
|
security = @sdk_configuration.security_source&.call
|
|
670
634
|
|
|
@@ -702,32 +666,12 @@ module FastpixClient
|
|
|
702
666
|
rescue StandardError => e
|
|
703
667
|
error = e
|
|
704
668
|
ensure
|
|
705
|
-
|
|
706
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
707
|
-
error: error,
|
|
708
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
709
|
-
hook_ctx: hook_ctx
|
|
710
|
-
),
|
|
711
|
-
response: http_response
|
|
712
|
-
)
|
|
713
|
-
else
|
|
714
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
715
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
716
|
-
hook_ctx: hook_ctx
|
|
717
|
-
),
|
|
718
|
-
response: http_response
|
|
719
|
-
)
|
|
720
|
-
end
|
|
721
|
-
|
|
722
|
-
if http_response.nil?
|
|
723
|
-
raise error if !error.nil?
|
|
724
|
-
raise 'no response'
|
|
725
|
-
end
|
|
669
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
726
670
|
end
|
|
727
671
|
|
|
728
|
-
content_type = http_response.headers.fetch(
|
|
672
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
729
673
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
730
|
-
if Utils.match_content_type(content_type,
|
|
674
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
731
675
|
http_response = @sdk_configuration.hooks.after_success(
|
|
732
676
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
733
677
|
hook_ctx: hook_ctx
|
|
@@ -745,14 +689,14 @@ module FastpixClient
|
|
|
745
689
|
|
|
746
690
|
return response
|
|
747
691
|
else
|
|
748
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
692
|
+
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
|
|
749
693
|
end
|
|
750
694
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
751
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
695
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
752
696
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
753
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
697
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
754
698
|
else
|
|
755
|
-
if Utils.match_content_type(content_type,
|
|
699
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
756
700
|
http_response = @sdk_configuration.hooks.after_success(
|
|
757
701
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
758
702
|
hook_ctx: hook_ctx
|
|
@@ -770,7 +714,7 @@ module FastpixClient
|
|
|
770
714
|
|
|
771
715
|
return response
|
|
772
716
|
else
|
|
773
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
717
|
+
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
|
|
774
718
|
end
|
|
775
719
|
end
|
|
776
720
|
end
|
|
@@ -793,18 +737,17 @@ module FastpixClient
|
|
|
793
737
|
#
|
|
794
738
|
# #### Webhook events
|
|
795
739
|
#
|
|
796
|
-
# 1. After successfully adding a track, your system must receive the webhook event <a href="https://fastpix.com/docs/
|
|
740
|
+
# 1. After successfully adding a track, your system must receive the webhook event <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediatrackcreated">video.media.track.created</a>.
|
|
797
741
|
#
|
|
798
|
-
# 2. Once the track is processed and ready, you must receive the webhook event <a href="https://fastpix.com/docs/
|
|
742
|
+
# 2. Once the track is processed and ready, you must receive the webhook event <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediatrackready">video.media.track.ready</a>.
|
|
799
743
|
#
|
|
800
|
-
# 3. Finally, an update event <a href="https://fastpix.com/docs/
|
|
744
|
+
# 3. Finally, an update event <a href="https://fastpix.com/docs/webhooks/media-events#videomediaupdated">video.media.updated</a> must notify your system about the media's updated status.
|
|
801
745
|
#
|
|
802
746
|
#
|
|
803
747
|
# #### Example
|
|
804
748
|
# Suppose you have a video uploaded to the FastPix platform, and you want to add an Italian audio track to it. By calling this API, you can attach an external audio file (https://static.fastpix.com/music-1.mp3) to the media file. Similarly, if you need to add subtitles in different languages, you can specify type: `subtitle` with the corresponding subtitle `url`, `languageCode` and `languageName`.
|
|
805
749
|
#
|
|
806
|
-
# Related guides: <a href="https://fastpix.com/docs/
|
|
807
|
-
#
|
|
750
|
+
# Related guides: <a href="https://fastpix.com/docs/video-on-demand/add-subtitles-to-a-video">Add own subtitle tracks</a>, <a href="https://fastpix.com/docs/video-on-demand/add-audio-to-a-video">Add own audio tracks</a>
|
|
808
751
|
request = Models::Operations::AddMediaTrackRequest.new(
|
|
809
752
|
media_id: media_id,
|
|
810
753
|
body: body
|
|
@@ -820,18 +763,10 @@ module FastpixClient
|
|
|
820
763
|
headers = {}
|
|
821
764
|
headers = T.cast(headers, T::Hash[String, String])
|
|
822
765
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
823
|
-
headers[
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
body = Utils.encode_form(form)
|
|
828
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
829
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
830
|
-
else
|
|
831
|
-
body = data
|
|
832
|
-
end
|
|
833
|
-
headers['Accept'] = 'application/json'
|
|
834
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
766
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
767
|
+
body = encode_request_body(req_content_type, data, form)
|
|
768
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
769
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
835
770
|
|
|
836
771
|
security = @sdk_configuration.security_source&.call
|
|
837
772
|
|
|
@@ -870,32 +805,12 @@ module FastpixClient
|
|
|
870
805
|
rescue StandardError => e
|
|
871
806
|
error = e
|
|
872
807
|
ensure
|
|
873
|
-
|
|
874
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
875
|
-
error: error,
|
|
876
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
877
|
-
hook_ctx: hook_ctx
|
|
878
|
-
),
|
|
879
|
-
response: http_response
|
|
880
|
-
)
|
|
881
|
-
else
|
|
882
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
883
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
884
|
-
hook_ctx: hook_ctx
|
|
885
|
-
),
|
|
886
|
-
response: http_response
|
|
887
|
-
)
|
|
888
|
-
end
|
|
889
|
-
|
|
890
|
-
if http_response.nil?
|
|
891
|
-
raise error if !error.nil?
|
|
892
|
-
raise 'no response'
|
|
893
|
-
end
|
|
808
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
894
809
|
end
|
|
895
810
|
|
|
896
|
-
content_type = http_response.headers.fetch(
|
|
811
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
897
812
|
if Utils.match_status_code(http_response.status, ['201'])
|
|
898
|
-
if Utils.match_content_type(content_type,
|
|
813
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
899
814
|
http_response = @sdk_configuration.hooks.after_success(
|
|
900
815
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
901
816
|
hook_ctx: hook_ctx
|
|
@@ -913,14 +828,14 @@ module FastpixClient
|
|
|
913
828
|
|
|
914
829
|
return response
|
|
915
830
|
else
|
|
916
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
831
|
+
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
|
|
917
832
|
end
|
|
918
833
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
919
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
834
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
920
835
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
921
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
836
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
922
837
|
else
|
|
923
|
-
if Utils.match_content_type(content_type,
|
|
838
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
924
839
|
http_response = @sdk_configuration.hooks.after_success(
|
|
925
840
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
926
841
|
hook_ctx: hook_ctx
|
|
@@ -938,7 +853,7 @@ module FastpixClient
|
|
|
938
853
|
|
|
939
854
|
return response
|
|
940
855
|
else
|
|
941
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
856
|
+
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
|
|
942
857
|
end
|
|
943
858
|
end
|
|
944
859
|
end
|
|
@@ -956,7 +871,7 @@ module FastpixClient
|
|
|
956
871
|
#
|
|
957
872
|
# #### Webhook Events
|
|
958
873
|
#
|
|
959
|
-
# Once the upload is cancelled, you must receive the webhook event <a href="https://fastpix.com/docs/
|
|
874
|
+
# Once the upload is cancelled, you must receive the webhook event <a href="https://fastpix.com/docs/webhooks/media-events#videomediauploadcancelled">video.media.upload.cancelled</a>.
|
|
960
875
|
#
|
|
961
876
|
# #### Example
|
|
962
877
|
#
|
|
@@ -975,8 +890,8 @@ module FastpixClient
|
|
|
975
890
|
)
|
|
976
891
|
headers = {}
|
|
977
892
|
headers = T.cast(headers, T::Hash[String, String])
|
|
978
|
-
headers['Accept'] =
|
|
979
|
-
headers[
|
|
893
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
894
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
980
895
|
|
|
981
896
|
security = @sdk_configuration.security_source&.call
|
|
982
897
|
|
|
@@ -1014,32 +929,12 @@ module FastpixClient
|
|
|
1014
929
|
rescue StandardError => e
|
|
1015
930
|
error = e
|
|
1016
931
|
ensure
|
|
1017
|
-
|
|
1018
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1019
|
-
error: error,
|
|
1020
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1021
|
-
hook_ctx: hook_ctx
|
|
1022
|
-
),
|
|
1023
|
-
response: http_response
|
|
1024
|
-
)
|
|
1025
|
-
else
|
|
1026
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1027
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1028
|
-
hook_ctx: hook_ctx
|
|
1029
|
-
),
|
|
1030
|
-
response: http_response
|
|
1031
|
-
)
|
|
1032
|
-
end
|
|
1033
|
-
|
|
1034
|
-
if http_response.nil?
|
|
1035
|
-
raise error if !error.nil?
|
|
1036
|
-
raise 'no response'
|
|
1037
|
-
end
|
|
932
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1038
933
|
end
|
|
1039
934
|
|
|
1040
|
-
content_type = http_response.headers.fetch(
|
|
935
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1041
936
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1042
|
-
if Utils.match_content_type(content_type,
|
|
937
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1043
938
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1044
939
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1045
940
|
hook_ctx: hook_ctx
|
|
@@ -1057,14 +952,14 @@ module FastpixClient
|
|
|
1057
952
|
|
|
1058
953
|
return response
|
|
1059
954
|
else
|
|
1060
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
955
|
+
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
|
|
1061
956
|
end
|
|
1062
957
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1063
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
958
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1064
959
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1065
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
960
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1066
961
|
else
|
|
1067
|
-
if Utils.match_content_type(content_type,
|
|
962
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1068
963
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1069
964
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1070
965
|
hook_ctx: hook_ctx
|
|
@@ -1082,7 +977,7 @@ module FastpixClient
|
|
|
1082
977
|
|
|
1083
978
|
return response
|
|
1084
979
|
else
|
|
1085
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
980
|
+
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
|
|
1086
981
|
end
|
|
1087
982
|
end
|
|
1088
983
|
end
|
|
@@ -1106,11 +1001,11 @@ module FastpixClient
|
|
|
1106
1001
|
#
|
|
1107
1002
|
# After updating a track, your system must receive webhook notifications:
|
|
1108
1003
|
#
|
|
1109
|
-
# 1. After successfully updating a track, your system must receive the webhook event <a href="https://fastpix.com/docs/
|
|
1004
|
+
# 1. After successfully updating a track, your system must receive the webhook event <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediatrackupdated">video.media.track.updated</a>.
|
|
1110
1005
|
#
|
|
1111
|
-
# 2. Once the new track is processed and ready, you must receive the webhook event <a href="https://fastpix.com/docs/
|
|
1006
|
+
# 2. Once the new track is processed and ready, you must receive the webhook event <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediatrackready">video.media.track.ready</a>.
|
|
1112
1007
|
#
|
|
1113
|
-
# 3. Once the media file is updated with the new track details, a <a href="https://fastpix.com/docs/
|
|
1008
|
+
# 3. Once the media file is updated with the new track details, a <a href="https://fastpix.com/docs/webhooks/media-events#videomediaupdated">video.media.updated</a> event must be triggered.
|
|
1114
1009
|
#
|
|
1115
1010
|
#
|
|
1116
1011
|
# #### Example
|
|
@@ -1119,8 +1014,8 @@ module FastpixClient
|
|
|
1119
1014
|
# - The original track file has errors and needs correction.
|
|
1120
1015
|
# - You want to improve subtitle translations or replace an audio track with a better-quality version.
|
|
1121
1016
|
#
|
|
1122
|
-
# Related guides: <a href="https://fastpix.com/docs/manage-audio-and-subtitle-tracks/add-subtitles-to-a-video">Add own subtitle tracks</a>, <a href="https://fastpix.com/docs/manage-audio-and-subtitle-tracks/add-audio-to-a-video">Add own audio tracks</a>
|
|
1123
1017
|
#
|
|
1018
|
+
# Related guides: <a href="https://fastpix.com/docs/video-on-demand/add-subtitles-to-a-video">Add own subtitle tracks</a>, <a href="https://fastpix.com/docs/video-on-demand/add-audio-to-a-video">Add own audio tracks</a>
|
|
1124
1019
|
request = Models::Operations::UpdateMediaTrackRequest.new(
|
|
1125
1020
|
track_id: track_id,
|
|
1126
1021
|
media_id: media_id,
|
|
@@ -1137,18 +1032,10 @@ module FastpixClient
|
|
|
1137
1032
|
headers = {}
|
|
1138
1033
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1139
1034
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
1140
|
-
headers[
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
body = Utils.encode_form(form)
|
|
1145
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1146
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1147
|
-
else
|
|
1148
|
-
body = data
|
|
1149
|
-
end
|
|
1150
|
-
headers['Accept'] = 'application/json'
|
|
1151
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1035
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1036
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1037
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1038
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1152
1039
|
|
|
1153
1040
|
security = @sdk_configuration.security_source&.call
|
|
1154
1041
|
|
|
@@ -1187,32 +1074,12 @@ module FastpixClient
|
|
|
1187
1074
|
rescue StandardError => e
|
|
1188
1075
|
error = e
|
|
1189
1076
|
ensure
|
|
1190
|
-
|
|
1191
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1192
|
-
error: error,
|
|
1193
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1194
|
-
hook_ctx: hook_ctx
|
|
1195
|
-
),
|
|
1196
|
-
response: http_response
|
|
1197
|
-
)
|
|
1198
|
-
else
|
|
1199
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1200
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1201
|
-
hook_ctx: hook_ctx
|
|
1202
|
-
),
|
|
1203
|
-
response: http_response
|
|
1204
|
-
)
|
|
1205
|
-
end
|
|
1206
|
-
|
|
1207
|
-
if http_response.nil?
|
|
1208
|
-
raise error if !error.nil?
|
|
1209
|
-
raise 'no response'
|
|
1210
|
-
end
|
|
1077
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1211
1078
|
end
|
|
1212
1079
|
|
|
1213
|
-
content_type = http_response.headers.fetch(
|
|
1080
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1214
1081
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1215
|
-
if Utils.match_content_type(content_type,
|
|
1082
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1216
1083
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1217
1084
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1218
1085
|
hook_ctx: hook_ctx
|
|
@@ -1230,14 +1097,14 @@ module FastpixClient
|
|
|
1230
1097
|
|
|
1231
1098
|
return response
|
|
1232
1099
|
else
|
|
1233
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1100
|
+
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
|
|
1234
1101
|
end
|
|
1235
1102
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1236
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1103
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1237
1104
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1238
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1105
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1239
1106
|
else
|
|
1240
|
-
if Utils.match_content_type(content_type,
|
|
1107
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1241
1108
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1242
1109
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1243
1110
|
hook_ctx: hook_ctx
|
|
@@ -1255,7 +1122,7 @@ module FastpixClient
|
|
|
1255
1122
|
|
|
1256
1123
|
return response
|
|
1257
1124
|
else
|
|
1258
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1125
|
+
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
|
|
1259
1126
|
end
|
|
1260
1127
|
end
|
|
1261
1128
|
end
|
|
@@ -1278,7 +1145,7 @@ module FastpixClient
|
|
|
1278
1145
|
#
|
|
1279
1146
|
# 1. After successfully deleting a track, your system must receive the webhook event **video.media.track.deleted**.
|
|
1280
1147
|
#
|
|
1281
|
-
# 2. Once the media file is updated to reflect the track removal, a <a href="https://fastpix.com/docs/
|
|
1148
|
+
# 2. Once the media file is updated to reflect the track removal, a <a href="https://fastpix.com/docs/webhooks/media-events#videomediaupdated">video.media.updated</a> event must be triggered.
|
|
1282
1149
|
#
|
|
1283
1150
|
#
|
|
1284
1151
|
# #### Example
|
|
@@ -1288,7 +1155,7 @@ module FastpixClient
|
|
|
1288
1155
|
# - The content owner requests the removal of a specific subtitle or audio track.
|
|
1289
1156
|
# - A new version of the track gets uploaded to replace the existing one.
|
|
1290
1157
|
#
|
|
1291
|
-
# Related guides: <a href="https://fastpix.com/docs/
|
|
1158
|
+
# Related guides: <a href="https://fastpix.com/docs/video-on-demand/add-subtitles-to-a-video">Add own subtitle tracks</a>, <a href="https://fastpix.com/docs/video-on-demand/add-audio-to-a-video">Add own audio tracks</a>
|
|
1292
1159
|
#
|
|
1293
1160
|
request = Models::Operations::DeleteMediaTrackRequest.new(
|
|
1294
1161
|
media_id: media_id,
|
|
@@ -1304,8 +1171,8 @@ module FastpixClient
|
|
|
1304
1171
|
)
|
|
1305
1172
|
headers = {}
|
|
1306
1173
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1307
|
-
headers['Accept'] =
|
|
1308
|
-
headers[
|
|
1174
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1175
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1309
1176
|
|
|
1310
1177
|
security = @sdk_configuration.security_source&.call
|
|
1311
1178
|
|
|
@@ -1343,32 +1210,12 @@ module FastpixClient
|
|
|
1343
1210
|
rescue StandardError => e
|
|
1344
1211
|
error = e
|
|
1345
1212
|
ensure
|
|
1346
|
-
|
|
1347
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1348
|
-
error: error,
|
|
1349
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1350
|
-
hook_ctx: hook_ctx
|
|
1351
|
-
),
|
|
1352
|
-
response: http_response
|
|
1353
|
-
)
|
|
1354
|
-
else
|
|
1355
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1356
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1357
|
-
hook_ctx: hook_ctx
|
|
1358
|
-
),
|
|
1359
|
-
response: http_response
|
|
1360
|
-
)
|
|
1361
|
-
end
|
|
1362
|
-
|
|
1363
|
-
if http_response.nil?
|
|
1364
|
-
raise error if !error.nil?
|
|
1365
|
-
raise 'no response'
|
|
1366
|
-
end
|
|
1213
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1367
1214
|
end
|
|
1368
1215
|
|
|
1369
|
-
content_type = http_response.headers.fetch(
|
|
1216
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1370
1217
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1371
|
-
if Utils.match_content_type(content_type,
|
|
1218
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1372
1219
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1373
1220
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1374
1221
|
hook_ctx: hook_ctx
|
|
@@ -1386,14 +1233,14 @@ module FastpixClient
|
|
|
1386
1233
|
|
|
1387
1234
|
return response
|
|
1388
1235
|
else
|
|
1389
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1236
|
+
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
|
|
1390
1237
|
end
|
|
1391
1238
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1392
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1239
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1393
1240
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1394
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1241
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1395
1242
|
else
|
|
1396
|
-
if Utils.match_content_type(content_type,
|
|
1243
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1397
1244
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1398
1245
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1399
1246
|
hook_ctx: hook_ctx
|
|
@@ -1411,7 +1258,7 @@ module FastpixClient
|
|
|
1411
1258
|
|
|
1412
1259
|
return response
|
|
1413
1260
|
else
|
|
1414
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1261
|
+
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
|
|
1415
1262
|
end
|
|
1416
1263
|
end
|
|
1417
1264
|
end
|
|
@@ -1432,11 +1279,11 @@ module FastpixClient
|
|
|
1432
1279
|
#
|
|
1433
1280
|
# #### Webhook Events
|
|
1434
1281
|
#
|
|
1435
|
-
# 1. After the subtitle track is generated and ready, you receive the webhook event <a href="https://fastpix.com/docs/
|
|
1282
|
+
# 1. After the subtitle track is generated and ready, you receive the webhook event <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediasubtitlegeneratedready">video.media.subtitle.generated</a>.
|
|
1436
1283
|
#
|
|
1437
|
-
# 2. Finally the <a href="https://fastpix.com/docs/
|
|
1284
|
+
# 2. Finally the <a href="https://fastpix.com/docs/webhooks/media-events#videomediaupdated">video.media.updated</a> event notifies your system about the media’s updated status.
|
|
1438
1285
|
#
|
|
1439
|
-
# </br> Related guide: <a href="https://fastpix.com/docs/
|
|
1286
|
+
# </br> Related guide: <a href="https://fastpix.com/docs/video-on-demand/generate-subtitles-automatically">Add auto-generated subtitles</a>
|
|
1440
1287
|
#
|
|
1441
1288
|
request = Models::Operations::GenerateSubtitleTrackRequest.new(
|
|
1442
1289
|
media_id: media_id,
|
|
@@ -1454,18 +1301,10 @@ module FastpixClient
|
|
|
1454
1301
|
headers = {}
|
|
1455
1302
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1456
1303
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
1457
|
-
headers[
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
body = Utils.encode_form(form)
|
|
1462
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1463
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1464
|
-
else
|
|
1465
|
-
body = data
|
|
1466
|
-
end
|
|
1467
|
-
headers['Accept'] = 'application/json'
|
|
1468
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1304
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1305
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1306
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1307
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1469
1308
|
|
|
1470
1309
|
security = @sdk_configuration.security_source&.call
|
|
1471
1310
|
|
|
@@ -1504,32 +1343,12 @@ module FastpixClient
|
|
|
1504
1343
|
rescue StandardError => e
|
|
1505
1344
|
error = e
|
|
1506
1345
|
ensure
|
|
1507
|
-
|
|
1508
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1509
|
-
error: error,
|
|
1510
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1511
|
-
hook_ctx: hook_ctx
|
|
1512
|
-
),
|
|
1513
|
-
response: http_response
|
|
1514
|
-
)
|
|
1515
|
-
else
|
|
1516
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1517
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1518
|
-
hook_ctx: hook_ctx
|
|
1519
|
-
),
|
|
1520
|
-
response: http_response
|
|
1521
|
-
)
|
|
1522
|
-
end
|
|
1523
|
-
|
|
1524
|
-
if http_response.nil?
|
|
1525
|
-
raise error if !error.nil?
|
|
1526
|
-
raise 'no response'
|
|
1527
|
-
end
|
|
1346
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1528
1347
|
end
|
|
1529
1348
|
|
|
1530
|
-
content_type = http_response.headers.fetch(
|
|
1349
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1531
1350
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1532
|
-
if Utils.match_content_type(content_type,
|
|
1351
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1533
1352
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1534
1353
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1535
1354
|
hook_ctx: hook_ctx
|
|
@@ -1547,14 +1366,14 @@ module FastpixClient
|
|
|
1547
1366
|
|
|
1548
1367
|
return response
|
|
1549
1368
|
else
|
|
1550
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1369
|
+
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
|
|
1551
1370
|
end
|
|
1552
1371
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1553
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1372
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1554
1373
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1555
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1374
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1556
1375
|
else
|
|
1557
|
-
if Utils.match_content_type(content_type,
|
|
1376
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1558
1377
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1559
1378
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1560
1379
|
hook_ctx: hook_ctx
|
|
@@ -1572,7 +1391,7 @@ module FastpixClient
|
|
|
1572
1391
|
|
|
1573
1392
|
return response
|
|
1574
1393
|
else
|
|
1575
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1394
|
+
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
|
|
1576
1395
|
end
|
|
1577
1396
|
end
|
|
1578
1397
|
end
|
|
@@ -1607,8 +1426,8 @@ module FastpixClient
|
|
|
1607
1426
|
)
|
|
1608
1427
|
headers = {}
|
|
1609
1428
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1610
|
-
headers['Accept'] =
|
|
1611
|
-
headers[
|
|
1429
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1430
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1612
1431
|
|
|
1613
1432
|
security = @sdk_configuration.security_source&.call
|
|
1614
1433
|
|
|
@@ -1646,32 +1465,12 @@ module FastpixClient
|
|
|
1646
1465
|
rescue StandardError => e
|
|
1647
1466
|
error = e
|
|
1648
1467
|
ensure
|
|
1649
|
-
|
|
1650
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1651
|
-
error: error,
|
|
1652
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1653
|
-
hook_ctx: hook_ctx
|
|
1654
|
-
),
|
|
1655
|
-
response: http_response
|
|
1656
|
-
)
|
|
1657
|
-
else
|
|
1658
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1659
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1660
|
-
hook_ctx: hook_ctx
|
|
1661
|
-
),
|
|
1662
|
-
response: http_response
|
|
1663
|
-
)
|
|
1664
|
-
end
|
|
1665
|
-
|
|
1666
|
-
if http_response.nil?
|
|
1667
|
-
raise error if !error.nil?
|
|
1668
|
-
raise 'no response'
|
|
1669
|
-
end
|
|
1468
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1670
1469
|
end
|
|
1671
1470
|
|
|
1672
|
-
content_type = http_response.headers.fetch(
|
|
1471
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1673
1472
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1674
|
-
if Utils.match_content_type(content_type,
|
|
1473
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1675
1474
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1676
1475
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1677
1476
|
hook_ctx: hook_ctx
|
|
@@ -1689,14 +1488,14 @@ module FastpixClient
|
|
|
1689
1488
|
|
|
1690
1489
|
return response
|
|
1691
1490
|
else
|
|
1692
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1491
|
+
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
|
|
1693
1492
|
end
|
|
1694
1493
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1695
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1494
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1696
1495
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1697
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1496
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1698
1497
|
else
|
|
1699
|
-
if Utils.match_content_type(content_type,
|
|
1498
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1700
1499
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1701
1500
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1702
1501
|
hook_ctx: hook_ctx
|
|
@@ -1714,7 +1513,7 @@ module FastpixClient
|
|
|
1714
1513
|
|
|
1715
1514
|
return response
|
|
1716
1515
|
else
|
|
1717
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1516
|
+
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
|
|
1718
1517
|
end
|
|
1719
1518
|
end
|
|
1720
1519
|
end
|
|
@@ -1732,7 +1531,7 @@ module FastpixClient
|
|
|
1732
1531
|
# 2. Include the updated `sourceAccess` parameter in the request body.
|
|
1733
1532
|
#
|
|
1734
1533
|
# 3. You receive a response confirming the update to the media’s source access status.
|
|
1735
|
-
# 4. Webhook events: <a href="https://fastpix.com/docs/
|
|
1534
|
+
# 4. Webhook events: <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediasourceready">video.media.source.ready</a>, <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediasourcedeleted">video.media.source.deleted</a>
|
|
1736
1535
|
#
|
|
1737
1536
|
request = Models::Operations::UpdatedSourceAccessRequest.new(
|
|
1738
1537
|
media_id: media_id,
|
|
@@ -1749,18 +1548,10 @@ module FastpixClient
|
|
|
1749
1548
|
headers = {}
|
|
1750
1549
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1751
1550
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
1752
|
-
headers[
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
body = Utils.encode_form(form)
|
|
1757
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1758
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1759
|
-
else
|
|
1760
|
-
body = data
|
|
1761
|
-
end
|
|
1762
|
-
headers['Accept'] = 'application/json'
|
|
1763
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1551
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1552
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1553
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1554
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1764
1555
|
|
|
1765
1556
|
security = @sdk_configuration.security_source&.call
|
|
1766
1557
|
|
|
@@ -1799,32 +1590,12 @@ module FastpixClient
|
|
|
1799
1590
|
rescue StandardError => e
|
|
1800
1591
|
error = e
|
|
1801
1592
|
ensure
|
|
1802
|
-
|
|
1803
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1804
|
-
error: error,
|
|
1805
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1806
|
-
hook_ctx: hook_ctx
|
|
1807
|
-
),
|
|
1808
|
-
response: http_response
|
|
1809
|
-
)
|
|
1810
|
-
else
|
|
1811
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1812
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1813
|
-
hook_ctx: hook_ctx
|
|
1814
|
-
),
|
|
1815
|
-
response: http_response
|
|
1816
|
-
)
|
|
1817
|
-
end
|
|
1818
|
-
|
|
1819
|
-
if http_response.nil?
|
|
1820
|
-
raise error if !error.nil?
|
|
1821
|
-
raise 'no response'
|
|
1822
|
-
end
|
|
1593
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1823
1594
|
end
|
|
1824
1595
|
|
|
1825
|
-
content_type = http_response.headers.fetch(
|
|
1596
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1826
1597
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1827
|
-
if Utils.match_content_type(content_type,
|
|
1598
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1828
1599
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1829
1600
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1830
1601
|
hook_ctx: hook_ctx
|
|
@@ -1842,14 +1613,14 @@ module FastpixClient
|
|
|
1842
1613
|
|
|
1843
1614
|
return response
|
|
1844
1615
|
else
|
|
1845
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1616
|
+
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
|
|
1846
1617
|
end
|
|
1847
1618
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1848
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1619
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1849
1620
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1850
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1621
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
1851
1622
|
else
|
|
1852
|
-
if Utils.match_content_type(content_type,
|
|
1623
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1853
1624
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1854
1625
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1855
1626
|
hook_ctx: hook_ctx
|
|
@@ -1867,7 +1638,7 @@ module FastpixClient
|
|
|
1867
1638
|
|
|
1868
1639
|
return response
|
|
1869
1640
|
else
|
|
1870
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1641
|
+
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
|
|
1871
1642
|
end
|
|
1872
1643
|
end
|
|
1873
1644
|
end
|
|
@@ -1898,13 +1669,13 @@ module FastpixClient
|
|
|
1898
1669
|
#
|
|
1899
1670
|
# #### Webhook events
|
|
1900
1671
|
#
|
|
1901
|
-
# - <a href="https://fastpix.com/docs/
|
|
1672
|
+
# - <a href="https://fastpix.com/docs/webhooks/transform-media-events#videomediamp4supportready">video.media.mp4Support.ready</a> – Triggered when the MP4 support setting is successfully updated.
|
|
1902
1673
|
#
|
|
1903
1674
|
# #### Example
|
|
1904
1675
|
# Suppose you have a video uploaded to the FastPix platform, and you want to allow users to download the video in MP4 format. By setting "mp4Support": "capped_4k", the system generates an MP4 rendition of the video up to 4K resolution, making it available for download through the stream URL(`https://stream.fastpix.com/{playbackId}/{capped-4k.mp4 | audio.m4a}`). If you want users to stream only the audio from the media file, you can set "mp4Support": "audioOnly". This provides an audio-only stream URL that allows users to listen to the media without video. By setting "mp4Support": "audioOnly,capped_4k", both options are enabled. Users can download the MP4 video and also stream just the audio version of the media.
|
|
1905
1676
|
#
|
|
1906
1677
|
#
|
|
1907
|
-
# Related guide: <a href="https://fastpix.com/docs/
|
|
1678
|
+
# Related guide: <a href="https://fastpix.com/docs/video-on-demand/enable-mp4-support-for-offline-viewing">Use MP4 support for offline viewing</a>
|
|
1908
1679
|
#
|
|
1909
1680
|
request = Models::Operations::UpdatedMp4SupportRequest.new(
|
|
1910
1681
|
media_id: media_id,
|
|
@@ -1921,18 +1692,10 @@ module FastpixClient
|
|
|
1921
1692
|
headers = {}
|
|
1922
1693
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1923
1694
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
1924
|
-
headers[
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
body = Utils.encode_form(form)
|
|
1929
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1930
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1931
|
-
else
|
|
1932
|
-
body = data
|
|
1933
|
-
end
|
|
1934
|
-
headers['Accept'] = 'application/json'
|
|
1935
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1695
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1696
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1697
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1698
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1936
1699
|
|
|
1937
1700
|
security = @sdk_configuration.security_source&.call
|
|
1938
1701
|
|
|
@@ -1971,32 +1734,12 @@ module FastpixClient
|
|
|
1971
1734
|
rescue StandardError => e
|
|
1972
1735
|
error = e
|
|
1973
1736
|
ensure
|
|
1974
|
-
|
|
1975
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
1976
|
-
error: error,
|
|
1977
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1978
|
-
hook_ctx: hook_ctx
|
|
1979
|
-
),
|
|
1980
|
-
response: http_response
|
|
1981
|
-
)
|
|
1982
|
-
else
|
|
1983
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
1984
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1985
|
-
hook_ctx: hook_ctx
|
|
1986
|
-
),
|
|
1987
|
-
response: http_response
|
|
1988
|
-
)
|
|
1989
|
-
end
|
|
1990
|
-
|
|
1991
|
-
if http_response.nil?
|
|
1992
|
-
raise error if !error.nil?
|
|
1993
|
-
raise 'no response'
|
|
1994
|
-
end
|
|
1737
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1995
1738
|
end
|
|
1996
1739
|
|
|
1997
|
-
content_type = http_response.headers.fetch(
|
|
1740
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1998
1741
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1999
|
-
if Utils.match_content_type(content_type,
|
|
1742
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2000
1743
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2001
1744
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2002
1745
|
hook_ctx: hook_ctx
|
|
@@ -2014,14 +1757,14 @@ module FastpixClient
|
|
|
2014
1757
|
|
|
2015
1758
|
return response
|
|
2016
1759
|
else
|
|
2017
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1760
|
+
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
|
|
2018
1761
|
end
|
|
2019
1762
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
2020
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1763
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2021
1764
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
2022
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1765
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2023
1766
|
else
|
|
2024
|
-
if Utils.match_content_type(content_type,
|
|
1767
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2025
1768
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2026
1769
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2027
1770
|
hook_ctx: hook_ctx
|
|
@@ -2039,7 +1782,7 @@ module FastpixClient
|
|
|
2039
1782
|
|
|
2040
1783
|
return response
|
|
2041
1784
|
else
|
|
2042
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1785
|
+
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
|
|
2043
1786
|
end
|
|
2044
1787
|
end
|
|
2045
1788
|
end
|
|
@@ -2076,8 +1819,8 @@ module FastpixClient
|
|
|
2076
1819
|
)
|
|
2077
1820
|
headers = {}
|
|
2078
1821
|
headers = T.cast(headers, T::Hash[String, String])
|
|
2079
|
-
headers['Accept'] =
|
|
2080
|
-
headers[
|
|
1822
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1823
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
2081
1824
|
|
|
2082
1825
|
security = @sdk_configuration.security_source&.call
|
|
2083
1826
|
|
|
@@ -2115,32 +1858,12 @@ module FastpixClient
|
|
|
2115
1858
|
rescue StandardError => e
|
|
2116
1859
|
error = e
|
|
2117
1860
|
ensure
|
|
2118
|
-
|
|
2119
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
2120
|
-
error: error,
|
|
2121
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
2122
|
-
hook_ctx: hook_ctx
|
|
2123
|
-
),
|
|
2124
|
-
response: http_response
|
|
2125
|
-
)
|
|
2126
|
-
else
|
|
2127
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
2128
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2129
|
-
hook_ctx: hook_ctx
|
|
2130
|
-
),
|
|
2131
|
-
response: http_response
|
|
2132
|
-
)
|
|
2133
|
-
end
|
|
2134
|
-
|
|
2135
|
-
if http_response.nil?
|
|
2136
|
-
raise error if !error.nil?
|
|
2137
|
-
raise 'no response'
|
|
2138
|
-
end
|
|
1861
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
2139
1862
|
end
|
|
2140
1863
|
|
|
2141
|
-
content_type = http_response.headers.fetch(
|
|
1864
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
2142
1865
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
2143
|
-
if Utils.match_content_type(content_type,
|
|
1866
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2144
1867
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2145
1868
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2146
1869
|
hook_ctx: hook_ctx
|
|
@@ -2158,14 +1881,14 @@ module FastpixClient
|
|
|
2158
1881
|
|
|
2159
1882
|
return response
|
|
2160
1883
|
else
|
|
2161
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1884
|
+
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
|
|
2162
1885
|
end
|
|
2163
1886
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
2164
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1887
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2165
1888
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
2166
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1889
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2167
1890
|
else
|
|
2168
|
-
if Utils.match_content_type(content_type,
|
|
1891
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2169
1892
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2170
1893
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2171
1894
|
hook_ctx: hook_ctx
|
|
@@ -2183,7 +1906,7 @@ module FastpixClient
|
|
|
2183
1906
|
|
|
2184
1907
|
return response
|
|
2185
1908
|
else
|
|
2186
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1909
|
+
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
|
|
2187
1910
|
end
|
|
2188
1911
|
end
|
|
2189
1912
|
end
|
|
@@ -2220,8 +1943,8 @@ module FastpixClient
|
|
|
2220
1943
|
headers = {}
|
|
2221
1944
|
headers = T.cast(headers, T::Hash[String, String])
|
|
2222
1945
|
query_params = Utils.get_query_params(Models::Operations::ListUploadsRequest, request, nil)
|
|
2223
|
-
headers['Accept'] =
|
|
2224
|
-
headers[
|
|
1946
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1947
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
2225
1948
|
|
|
2226
1949
|
security = @sdk_configuration.security_source&.call
|
|
2227
1950
|
|
|
@@ -2260,32 +1983,12 @@ module FastpixClient
|
|
|
2260
1983
|
rescue StandardError => e
|
|
2261
1984
|
error = e
|
|
2262
1985
|
ensure
|
|
2263
|
-
|
|
2264
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
2265
|
-
error: error,
|
|
2266
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
2267
|
-
hook_ctx: hook_ctx
|
|
2268
|
-
),
|
|
2269
|
-
response: http_response
|
|
2270
|
-
)
|
|
2271
|
-
else
|
|
2272
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
2273
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2274
|
-
hook_ctx: hook_ctx
|
|
2275
|
-
),
|
|
2276
|
-
response: http_response
|
|
2277
|
-
)
|
|
2278
|
-
end
|
|
2279
|
-
|
|
2280
|
-
if http_response.nil?
|
|
2281
|
-
raise error if !error.nil?
|
|
2282
|
-
raise 'no response'
|
|
2283
|
-
end
|
|
1986
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
2284
1987
|
end
|
|
2285
1988
|
|
|
2286
|
-
content_type = http_response.headers.fetch(
|
|
1989
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
2287
1990
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
2288
|
-
if Utils.match_content_type(content_type,
|
|
1991
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2289
1992
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2290
1993
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2291
1994
|
hook_ctx: hook_ctx
|
|
@@ -2303,14 +2006,14 @@ module FastpixClient
|
|
|
2303
2006
|
|
|
2304
2007
|
return response
|
|
2305
2008
|
else
|
|
2306
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2009
|
+
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
|
|
2307
2010
|
end
|
|
2308
2011
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
2309
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2012
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2310
2013
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
2311
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2014
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2312
2015
|
else
|
|
2313
|
-
if Utils.match_content_type(content_type,
|
|
2016
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2314
2017
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2315
2018
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2316
2019
|
hook_ctx: hook_ctx
|
|
@@ -2328,7 +2031,7 @@ module FastpixClient
|
|
|
2328
2031
|
|
|
2329
2032
|
return response
|
|
2330
2033
|
else
|
|
2331
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2034
|
+
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
|
|
2332
2035
|
end
|
|
2333
2036
|
end
|
|
2334
2037
|
end
|
|
@@ -2354,7 +2057,7 @@ module FastpixClient
|
|
|
2354
2057
|
#
|
|
2355
2058
|
# Imagine you’re managing a video editing platform where users upload full-length videos and create short clips for social media sharing. To keep track of all clips linked to a particular video, you call this API with the sourceMediaId. The response provides a list of all associated clips, allowing you to manage, edit, or repurpose them as needed.
|
|
2356
2059
|
#
|
|
2357
|
-
# Related guide: <a href="https://fastpix.com/docs/
|
|
2060
|
+
# Related guide: <a href="https://fastpix.com/docs/video-on-demand/clip-and-trim-videos">Create clips from existing media</a>
|
|
2358
2061
|
#
|
|
2359
2062
|
request = Models::Operations::GetMediaClipsRequest.new(
|
|
2360
2063
|
media_id: media_id,
|
|
@@ -2373,8 +2076,8 @@ module FastpixClient
|
|
|
2373
2076
|
headers = {}
|
|
2374
2077
|
headers = T.cast(headers, T::Hash[String, String])
|
|
2375
2078
|
query_params = Utils.get_query_params(Models::Operations::GetMediaClipsRequest, request, nil)
|
|
2376
|
-
headers['Accept'] =
|
|
2377
|
-
headers[
|
|
2079
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
2080
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
2378
2081
|
|
|
2379
2082
|
security = @sdk_configuration.security_source&.call
|
|
2380
2083
|
|
|
@@ -2413,32 +2116,12 @@ module FastpixClient
|
|
|
2413
2116
|
rescue StandardError => e
|
|
2414
2117
|
error = e
|
|
2415
2118
|
ensure
|
|
2416
|
-
|
|
2417
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
2418
|
-
error: error,
|
|
2419
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
2420
|
-
hook_ctx: hook_ctx
|
|
2421
|
-
),
|
|
2422
|
-
response: http_response
|
|
2423
|
-
)
|
|
2424
|
-
else
|
|
2425
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
2426
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2427
|
-
hook_ctx: hook_ctx
|
|
2428
|
-
),
|
|
2429
|
-
response: http_response
|
|
2430
|
-
)
|
|
2431
|
-
end
|
|
2432
|
-
|
|
2433
|
-
if http_response.nil?
|
|
2434
|
-
raise error if !error.nil?
|
|
2435
|
-
raise 'no response'
|
|
2436
|
-
end
|
|
2119
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
2437
2120
|
end
|
|
2438
2121
|
|
|
2439
|
-
content_type = http_response.headers.fetch(
|
|
2122
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
2440
2123
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
2441
|
-
if Utils.match_content_type(content_type,
|
|
2124
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2442
2125
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2443
2126
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2444
2127
|
hook_ctx: hook_ctx
|
|
@@ -2456,14 +2139,14 @@ module FastpixClient
|
|
|
2456
2139
|
|
|
2457
2140
|
return response
|
|
2458
2141
|
else
|
|
2459
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2142
|
+
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
|
|
2460
2143
|
end
|
|
2461
2144
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
2462
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2145
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2463
2146
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
2464
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2147
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
2465
2148
|
else
|
|
2466
|
-
if Utils.match_content_type(content_type,
|
|
2149
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2467
2150
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2468
2151
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2469
2152
|
hook_ctx: hook_ctx
|
|
@@ -2481,7 +2164,7 @@ module FastpixClient
|
|
|
2481
2164
|
|
|
2482
2165
|
return response
|
|
2483
2166
|
else
|
|
2484
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2167
|
+
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
|
|
2485
2168
|
end
|
|
2486
2169
|
end
|
|
2487
2170
|
end
|