fastpixapi 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/crystalline/metadata_fields.rb +56 -48
- data/lib/crystalline/types.rb +3 -3
- data/lib/crystalline.rb +4 -5
- data/lib/fastpix_client/dimensions.rb +51 -58
- data/lib/fastpix_client/drm_configurations.rb +49 -56
- data/lib/fastpix_client/errors.rb +35 -24
- data/lib/fastpix_client/fastpixapi.rb +2 -4
- data/lib/fastpix_client/in_video_ai_features.rb +100 -160
- data/lib/fastpix_client/input_video.rb +66 -74
- data/lib/fastpix_client/live_playback.rb +82 -99
- data/lib/fastpix_client/manage_live_stream.rb +136 -252
- data/lib/fastpix_client/manage_videos.rb +228 -543
- data/lib/fastpix_client/metrics.rb +76 -120
- 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/getallmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/getcreatelivestreamresponsedto.rb +9 -20
- data/lib/fastpix_client/models/components/getmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/live_media_clips.rb +9 -21
- data/lib/fastpix_client/models/components/media.rb +11 -26
- data/lib/fastpix_client/models/components/patchresponsedata.rb +9 -18
- data/lib/fastpix_client/models/components/sourceaccessmedia.rb +11 -26
- data/lib/fastpix_client/models/components/update_media.rb +11 -26
- data/lib/fastpix_client/models/components/views.rb +51 -124
- 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/push_media_settings.rb +9 -20
- data/lib/fastpix_client/playback.rb +122 -213
- data/lib/fastpix_client/playlist.rb +150 -296
- 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 +97 -141
- data/lib/fastpix_client/start_live_stream.rb +51 -33
- 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 +66 -90
- data/lib/fastpixapi.rb +10 -10
- data/lib/openssl_patch.rb +24 -24
- metadata +3 -2
|
@@ -14,6 +14,57 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class LivePlayback
|
|
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
|
+
UNKNOWN_CONTENT_TYPE_ERROR = 'Unknown content type received'
|
|
23
|
+
USER_AGENT_HEADER = 'user-agent'
|
|
24
|
+
|
|
25
|
+
# Applies the SDK after-request hooks and ensures a usable response is present.
|
|
26
|
+
sig { params(http_response: T.nilable(Faraday::Response), error: T.nilable(StandardError), hook_ctx: SDKHooks::HookContext).returns(Faraday::Response) }
|
|
27
|
+
def apply_after_request_hooks(http_response, error, hook_ctx)
|
|
28
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
29
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
30
|
+
error: error,
|
|
31
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
32
|
+
hook_ctx: hook_ctx
|
|
33
|
+
),
|
|
34
|
+
response: http_response
|
|
35
|
+
)
|
|
36
|
+
else
|
|
37
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
38
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
39
|
+
hook_ctx: hook_ctx
|
|
40
|
+
),
|
|
41
|
+
response: http_response
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if http_response.nil?
|
|
46
|
+
raise error unless error.nil?
|
|
47
|
+
raise ::FastpixClient::Models::Errors::EmptyResponseError, 'no response'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
http_response
|
|
51
|
+
end
|
|
52
|
+
private :apply_after_request_hooks
|
|
53
|
+
|
|
54
|
+
# Encodes the request body based on its serialized content type.
|
|
55
|
+
sig { params(req_content_type: T.nilable(String), data: T.untyped, form: T.untyped).returns(T.untyped) }
|
|
56
|
+
def encode_request_body(req_content_type, data, form)
|
|
57
|
+
raise ArgumentError, 'request body is required' if data.nil? && form.nil?
|
|
58
|
+
|
|
59
|
+
if form
|
|
60
|
+
Utils.encode_form(form)
|
|
61
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
62
|
+
URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
63
|
+
else
|
|
64
|
+
data
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
private :encode_request_body
|
|
17
68
|
|
|
18
69
|
# Operations for live stream playback management
|
|
19
70
|
|
|
@@ -65,17 +116,9 @@ module FastpixClient
|
|
|
65
116
|
headers = T.cast(headers, T::Hash[String, String])
|
|
66
117
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
67
118
|
headers['content-type'] = req_content_type
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
body = Utils.encode_form(form)
|
|
72
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
73
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
74
|
-
else
|
|
75
|
-
body = data
|
|
76
|
-
end
|
|
77
|
-
headers['Accept'] = 'application/json'
|
|
78
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
119
|
+
body = encode_request_body(req_content_type, data, form)
|
|
120
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
121
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
79
122
|
|
|
80
123
|
security = @sdk_configuration.security_source&.call
|
|
81
124
|
|
|
@@ -114,32 +157,12 @@ module FastpixClient
|
|
|
114
157
|
rescue StandardError => e
|
|
115
158
|
error = e
|
|
116
159
|
ensure
|
|
117
|
-
|
|
118
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
119
|
-
error: error,
|
|
120
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
121
|
-
hook_ctx: hook_ctx
|
|
122
|
-
),
|
|
123
|
-
response: http_response
|
|
124
|
-
)
|
|
125
|
-
else
|
|
126
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
127
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
128
|
-
hook_ctx: hook_ctx
|
|
129
|
-
),
|
|
130
|
-
response: http_response
|
|
131
|
-
)
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
if http_response.nil?
|
|
135
|
-
raise error if !error.nil?
|
|
136
|
-
raise 'no response'
|
|
137
|
-
end
|
|
160
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
138
161
|
end
|
|
139
162
|
|
|
140
|
-
content_type = http_response.headers.fetch(
|
|
163
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
141
164
|
if Utils.match_status_code(http_response.status, ['201'])
|
|
142
|
-
if Utils.match_content_type(content_type,
|
|
165
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
143
166
|
http_response = @sdk_configuration.hooks.after_success(
|
|
144
167
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
145
168
|
hook_ctx: hook_ctx
|
|
@@ -157,14 +180,14 @@ module FastpixClient
|
|
|
157
180
|
|
|
158
181
|
return response
|
|
159
182
|
else
|
|
160
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
183
|
+
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
|
|
161
184
|
end
|
|
162
185
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
163
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
186
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
164
187
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
165
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
188
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
166
189
|
else
|
|
167
|
-
if Utils.match_content_type(content_type,
|
|
190
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
168
191
|
http_response = @sdk_configuration.hooks.after_success(
|
|
169
192
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
170
193
|
hook_ctx: hook_ctx
|
|
@@ -182,7 +205,7 @@ module FastpixClient
|
|
|
182
205
|
|
|
183
206
|
return response
|
|
184
207
|
else
|
|
185
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
208
|
+
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
|
|
186
209
|
end
|
|
187
210
|
end
|
|
188
211
|
end
|
|
@@ -210,8 +233,8 @@ module FastpixClient
|
|
|
210
233
|
headers = {}
|
|
211
234
|
headers = T.cast(headers, T::Hash[String, String])
|
|
212
235
|
query_params = Utils.get_query_params(Models::Operations::DeletePlaybackIdOfStreamRequest, request, nil)
|
|
213
|
-
headers['Accept'] =
|
|
214
|
-
headers[
|
|
236
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
237
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
215
238
|
|
|
216
239
|
security = @sdk_configuration.security_source&.call
|
|
217
240
|
|
|
@@ -250,32 +273,12 @@ module FastpixClient
|
|
|
250
273
|
rescue StandardError => e
|
|
251
274
|
error = e
|
|
252
275
|
ensure
|
|
253
|
-
|
|
254
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
255
|
-
error: error,
|
|
256
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
257
|
-
hook_ctx: hook_ctx
|
|
258
|
-
),
|
|
259
|
-
response: http_response
|
|
260
|
-
)
|
|
261
|
-
else
|
|
262
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
263
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
264
|
-
hook_ctx: hook_ctx
|
|
265
|
-
),
|
|
266
|
-
response: http_response
|
|
267
|
-
)
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
if http_response.nil?
|
|
271
|
-
raise error if !error.nil?
|
|
272
|
-
raise 'no response'
|
|
273
|
-
end
|
|
276
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
274
277
|
end
|
|
275
278
|
|
|
276
|
-
content_type = http_response.headers.fetch(
|
|
279
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
277
280
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
278
|
-
if Utils.match_content_type(content_type,
|
|
281
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
279
282
|
http_response = @sdk_configuration.hooks.after_success(
|
|
280
283
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
281
284
|
hook_ctx: hook_ctx
|
|
@@ -293,14 +296,14 @@ module FastpixClient
|
|
|
293
296
|
|
|
294
297
|
return response
|
|
295
298
|
else
|
|
296
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
299
|
+
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
|
|
297
300
|
end
|
|
298
301
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
299
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
302
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
300
303
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
301
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
304
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
302
305
|
else
|
|
303
|
-
if Utils.match_content_type(content_type,
|
|
306
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
304
307
|
http_response = @sdk_configuration.hooks.after_success(
|
|
305
308
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
306
309
|
hook_ctx: hook_ctx
|
|
@@ -318,7 +321,7 @@ module FastpixClient
|
|
|
318
321
|
|
|
319
322
|
return response
|
|
320
323
|
else
|
|
321
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
324
|
+
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
|
|
322
325
|
end
|
|
323
326
|
end
|
|
324
327
|
end
|
|
@@ -345,8 +348,8 @@ module FastpixClient
|
|
|
345
348
|
)
|
|
346
349
|
headers = {}
|
|
347
350
|
headers = T.cast(headers, T::Hash[String, String])
|
|
348
|
-
headers['Accept'] =
|
|
349
|
-
headers[
|
|
351
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
352
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
350
353
|
|
|
351
354
|
security = @sdk_configuration.security_source&.call
|
|
352
355
|
|
|
@@ -384,32 +387,12 @@ module FastpixClient
|
|
|
384
387
|
rescue StandardError => e
|
|
385
388
|
error = e
|
|
386
389
|
ensure
|
|
387
|
-
|
|
388
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
389
|
-
error: error,
|
|
390
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
391
|
-
hook_ctx: hook_ctx
|
|
392
|
-
),
|
|
393
|
-
response: http_response
|
|
394
|
-
)
|
|
395
|
-
else
|
|
396
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
397
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
398
|
-
hook_ctx: hook_ctx
|
|
399
|
-
),
|
|
400
|
-
response: http_response
|
|
401
|
-
)
|
|
402
|
-
end
|
|
403
|
-
|
|
404
|
-
if http_response.nil?
|
|
405
|
-
raise error if !error.nil?
|
|
406
|
-
raise 'no response'
|
|
407
|
-
end
|
|
390
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
408
391
|
end
|
|
409
392
|
|
|
410
|
-
content_type = http_response.headers.fetch(
|
|
393
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
411
394
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
412
|
-
if Utils.match_content_type(content_type,
|
|
395
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
413
396
|
http_response = @sdk_configuration.hooks.after_success(
|
|
414
397
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
415
398
|
hook_ctx: hook_ctx
|
|
@@ -427,14 +410,14 @@ module FastpixClient
|
|
|
427
410
|
|
|
428
411
|
return response
|
|
429
412
|
else
|
|
430
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
413
|
+
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
|
|
431
414
|
end
|
|
432
415
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
433
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
416
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
434
417
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
435
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
418
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
436
419
|
else
|
|
437
|
-
if Utils.match_content_type(content_type,
|
|
420
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
438
421
|
http_response = @sdk_configuration.hooks.after_success(
|
|
439
422
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
440
423
|
hook_ctx: hook_ctx
|
|
@@ -452,7 +435,7 @@ module FastpixClient
|
|
|
452
435
|
|
|
453
436
|
return response
|
|
454
437
|
else
|
|
455
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
438
|
+
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
|
|
456
439
|
end
|
|
457
440
|
end
|
|
458
441
|
end
|