fastpixapi 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/crystalline/metadata_fields.rb +56 -48
- data/lib/crystalline/types.rb +3 -3
- data/lib/crystalline.rb +4 -5
- data/lib/fastpix_client/dimensions.rb +55 -62
- data/lib/fastpix_client/drm_configurations.rb +51 -58
- data/lib/fastpix_client/errors.rb +36 -25
- data/lib/fastpix_client/fastpixapi.rb +2 -4
- data/lib/fastpix_client/in_video_ai_features.rb +108 -168
- data/lib/fastpix_client/input_video.rb +75 -83
- data/lib/fastpix_client/live_playback.rb +82 -99
- data/lib/fastpix_client/manage_live_stream.rb +145 -261
- data/lib/fastpix_client/manage_videos.rb +252 -567
- data/lib/fastpix_client/metrics.rb +82 -126
- data/lib/fastpix_client/models/components/addtrackrequest.rb +1 -1
- data/lib/fastpix_client/models/components/createlivestreamresponsedto.rb +10 -18
- data/lib/fastpix_client/models/components/createmediarequest.rb +10 -19
- data/lib/fastpix_client/models/components/deletesigningkeyresponse.rb +6 -2
- data/lib/fastpix_client/models/components/deletesigningkeyresponsedata.rb +33 -0
- data/lib/fastpix_client/models/components/getallmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/getcreatelivestreamresponsedto.rb +9 -20
- data/lib/fastpix_client/models/components/getmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/live_media_clips.rb +9 -21
- data/lib/fastpix_client/models/components/media.rb +11 -26
- data/lib/fastpix_client/models/components/patchresponsedata.rb +9 -18
- data/lib/fastpix_client/models/components/pullvideoinput.rb +1 -1
- data/lib/fastpix_client/models/components/sourceaccessmedia.rb +11 -26
- data/lib/fastpix_client/models/components/update_media.rb +11 -26
- data/lib/fastpix_client/models/components/views.rb +52 -125
- data/lib/fastpix_client/models/components/watermarkinput.rb +1 -1
- data/lib/fastpix_client/models/components.rb +1 -0
- data/lib/fastpix_client/models/errors/empty_response_error.rb +15 -0
- data/lib/fastpix_client/models/errors.rb +1 -0
- data/lib/fastpix_client/models/operations/add_media_to_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/add_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/cancel_upload_response.rb +1 -1
- data/lib/fastpix_client/models/operations/change_media_order_in_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/complete_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_media_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_new_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_playbackid_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_signing_key_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_from_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_playbackid_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_signing_key_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/direct_upload_video_media_request.rb +1 -1
- data/lib/fastpix_client/models/operations/direct_upload_video_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/disable_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/enable_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/generate_subtitle_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_all_playlists_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_all_streams_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_viewer_count_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_clips_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_summary_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_playlist_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_signing_key_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_specific_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_timeseries_data_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_video_view_details_response.rb +1 -1
- data/lib/fastpix_client/models/operations/getdrmconfiguration_response.rb +1 -1
- data/lib/fastpix_client/models/operations/getdrmconfigurationbyid_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_breakdown_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_by_top_content_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_comparison_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_dimensions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_errors_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_filter_values_for_dimension_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_live_clips_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_overall_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_playback_ids_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_signing_keys_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_uploads_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_video_views_response.rb +1 -1
- data/lib/fastpix_client/models/operations/push_media_settings.rb +10 -21
- data/lib/fastpix_client/models/operations/retrievemediainputinfo_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_domain_restrictions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_chapters_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_moderation_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_named_entities_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_summary_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_specific_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_user_agent_restrictions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_mp4support_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_source_access_response.rb +1 -1
- data/lib/fastpix_client/playback.rb +123 -214
- data/lib/fastpix_client/playlist.rb +151 -297
- data/lib/fastpix_client/sdk_hooks/registration.rb +2 -2
- data/lib/fastpix_client/sdk_hooks/types.rb +4 -0
- data/lib/fastpix_client/sdkconfiguration.rb +4 -4
- data/lib/fastpix_client/signing_keys.rb +79 -123
- data/lib/fastpix_client/simulcast_stream.rb +101 -145
- data/lib/fastpix_client/start_live_stream.rb +54 -36
- data/lib/fastpix_client/utils/forms.rb +97 -101
- data/lib/fastpix_client/utils/headers.rb +44 -34
- data/lib/fastpix_client/utils/query_params.rb +39 -29
- data/lib/fastpix_client/utils/request_bodies.rb +4 -8
- data/lib/fastpix_client/utils/security.rb +30 -18
- data/lib/fastpix_client/utils/url.rb +83 -55
- data/lib/fastpix_client/utils/utils.rb +19 -37
- data/lib/fastpix_client/views.rb +71 -95
- data/lib/fastpixapi.rb +10 -10
- data/lib/openssl_patch.rb +24 -24
- metadata +20 -4
|
@@ -14,6 +14,37 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class Errors
|
|
16
16
|
extend T::Sig
|
|
17
|
+
|
|
18
|
+
CONTENT_TYPE_JSON = 'application/json'
|
|
19
|
+
|
|
20
|
+
# Applies the SDK after-request hooks and ensures a usable response is present.
|
|
21
|
+
sig { params(http_response: T.nilable(Faraday::Response), error: T.nilable(StandardError), hook_ctx: SDKHooks::HookContext).returns(Faraday::Response) }
|
|
22
|
+
def apply_after_request_hooks(http_response, error, hook_ctx)
|
|
23
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
24
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
25
|
+
error: error,
|
|
26
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
27
|
+
hook_ctx: hook_ctx
|
|
28
|
+
),
|
|
29
|
+
response: http_response
|
|
30
|
+
)
|
|
31
|
+
else
|
|
32
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
33
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
34
|
+
hook_ctx: hook_ctx
|
|
35
|
+
),
|
|
36
|
+
response: http_response
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
if http_response.nil?
|
|
41
|
+
raise error unless error.nil?
|
|
42
|
+
raise ::FastpixClient::Models::Errors::EmptyResponseError, 'no response'
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
http_response
|
|
46
|
+
end
|
|
47
|
+
private :apply_after_request_hooks
|
|
17
48
|
|
|
18
49
|
# Operations involving errors
|
|
19
50
|
|
|
@@ -58,7 +89,7 @@ module FastpixClient
|
|
|
58
89
|
# * **code:** The error code associated with the specific error.
|
|
59
90
|
#
|
|
60
91
|
#
|
|
61
|
-
# Related guide: <a href="https://
|
|
92
|
+
# Related guide: <a href="https://fastpix.com/docs/working-with-video-data/troubleshoot-playback-errors">Troubleshoot errors</a>
|
|
62
93
|
#
|
|
63
94
|
request = Models::Operations::ListErrorsRequest.new(
|
|
64
95
|
timespan: timespan,
|
|
@@ -71,7 +102,7 @@ module FastpixClient
|
|
|
71
102
|
headers = {}
|
|
72
103
|
headers = T.cast(headers, T::Hash[String, String])
|
|
73
104
|
query_params = Utils.get_query_params(Models::Operations::ListErrorsRequest, request, nil)
|
|
74
|
-
headers['Accept'] =
|
|
105
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
75
106
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
76
107
|
|
|
77
108
|
security = @sdk_configuration.security_source&.call
|
|
@@ -111,32 +142,12 @@ module FastpixClient
|
|
|
111
142
|
rescue StandardError => e
|
|
112
143
|
error = e
|
|
113
144
|
ensure
|
|
114
|
-
|
|
115
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
116
|
-
error: error,
|
|
117
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
118
|
-
hook_ctx: hook_ctx
|
|
119
|
-
),
|
|
120
|
-
response: http_response
|
|
121
|
-
)
|
|
122
|
-
else
|
|
123
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
124
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
125
|
-
hook_ctx: hook_ctx
|
|
126
|
-
),
|
|
127
|
-
response: http_response
|
|
128
|
-
)
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
if http_response.nil?
|
|
132
|
-
raise error if !error.nil?
|
|
133
|
-
raise 'no response'
|
|
134
|
-
end
|
|
145
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
135
146
|
end
|
|
136
147
|
|
|
137
148
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
138
149
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
139
|
-
if Utils.match_content_type(content_type,
|
|
150
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
140
151
|
http_response = @sdk_configuration.hooks.after_success(
|
|
141
152
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
142
153
|
hook_ctx: hook_ctx
|
|
@@ -161,7 +172,7 @@ module FastpixClient
|
|
|
161
172
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
162
173
|
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
163
174
|
else
|
|
164
|
-
if Utils.match_content_type(content_type,
|
|
175
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
165
176
|
http_response = @sdk_configuration.hooks.after_success(
|
|
166
177
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
167
178
|
hook_ctx: hook_ctx
|
|
@@ -54,10 +54,8 @@ module FastpixClient
|
|
|
54
54
|
# f.response :logger, nil, { headers: true, bodies: true, errors: true }
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
if !server_url.nil?
|
|
58
|
-
|
|
59
|
-
server_url = Utils.template_url(server_url, url_params)
|
|
60
|
-
end
|
|
57
|
+
if !server_url.nil? && !url_params.nil?
|
|
58
|
+
server_url = Utils.template_url(server_url, url_params)
|
|
61
59
|
end
|
|
62
60
|
|
|
63
61
|
server_idx = 0 if server_idx.nil?
|
|
@@ -14,6 +14,58 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class InVideoAIFeatures
|
|
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
|
+
REQUEST_CONTENT_TYPE_HEADER = 'content-type'
|
|
23
|
+
UNKNOWN_CONTENT_TYPE_ERROR = 'Unknown content type received'
|
|
24
|
+
USER_AGENT_HEADER = 'user-agent'
|
|
25
|
+
|
|
26
|
+
# Applies the SDK after-request hooks and ensures a usable response is present.
|
|
27
|
+
sig { params(http_response: T.nilable(Faraday::Response), error: T.nilable(StandardError), hook_ctx: SDKHooks::HookContext).returns(Faraday::Response) }
|
|
28
|
+
def apply_after_request_hooks(http_response, error, hook_ctx)
|
|
29
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
30
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
31
|
+
error: error,
|
|
32
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
33
|
+
hook_ctx: hook_ctx
|
|
34
|
+
),
|
|
35
|
+
response: http_response
|
|
36
|
+
)
|
|
37
|
+
else
|
|
38
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
39
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
40
|
+
hook_ctx: hook_ctx
|
|
41
|
+
),
|
|
42
|
+
response: http_response
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if http_response.nil?
|
|
47
|
+
raise error unless error.nil?
|
|
48
|
+
raise ::FastpixClient::Models::Errors::EmptyResponseError, 'no response'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
http_response
|
|
52
|
+
end
|
|
53
|
+
private :apply_after_request_hooks
|
|
54
|
+
|
|
55
|
+
# Encodes the request body based on its serialized content type.
|
|
56
|
+
sig { params(req_content_type: T.nilable(String), data: T.untyped, form: T.untyped).returns(T.untyped) }
|
|
57
|
+
def encode_request_body(req_content_type, data, form)
|
|
58
|
+
raise ArgumentError, 'request body is required' if data.nil? && form.nil?
|
|
59
|
+
|
|
60
|
+
if form
|
|
61
|
+
Utils.encode_form(form)
|
|
62
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
63
|
+
URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
64
|
+
else
|
|
65
|
+
data
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
private :encode_request_body
|
|
17
69
|
|
|
18
70
|
# Operations for AI-powered video features
|
|
19
71
|
|
|
@@ -50,7 +102,7 @@ module FastpixClient
|
|
|
50
102
|
# 3. Include the `summaryLength` parameter, specify the desired length of the summary in words (for example, 120 words), this determines how concise or detailed the summary will be. If no specific summary length is provided, the default length will be 100 words.
|
|
51
103
|
# 4. The response includes the updated media data and confirmation of the changes applied.
|
|
52
104
|
#
|
|
53
|
-
# You can use the <a href="https://
|
|
105
|
+
# You can use the <a href="https://fastpix.com/docs/ai-events/in-video-ai-events#videomediaaisummaryready">video.mediaAI.summary.ready</a> webhook event to track and notify about the summary generation.
|
|
54
106
|
#
|
|
55
107
|
#
|
|
56
108
|
#
|
|
@@ -58,7 +110,7 @@ module FastpixClient
|
|
|
58
110
|
#
|
|
59
111
|
# **Use case**: This is particularly useful when a user uploads a video and later chooses to generate a summary without needing to re-upload the video.
|
|
60
112
|
#
|
|
61
|
-
# Related guide: <a href="https://
|
|
113
|
+
# Related guide: <a href="https://fastpix.com/docs/video-intelligence/generate-a-video-summary">Video summary</a>
|
|
62
114
|
#
|
|
63
115
|
request = Models::Operations::UpdateMediaSummaryRequest.new(
|
|
64
116
|
media_id: media_id,
|
|
@@ -75,18 +127,10 @@ module FastpixClient
|
|
|
75
127
|
headers = {}
|
|
76
128
|
headers = T.cast(headers, T::Hash[String, String])
|
|
77
129
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
78
|
-
headers[
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
body = Utils.encode_form(form)
|
|
83
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
84
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
85
|
-
else
|
|
86
|
-
body = data
|
|
87
|
-
end
|
|
88
|
-
headers['Accept'] = 'application/json'
|
|
89
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
130
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
131
|
+
body = encode_request_body(req_content_type, data, form)
|
|
132
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
133
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
90
134
|
|
|
91
135
|
security = @sdk_configuration.security_source&.call
|
|
92
136
|
|
|
@@ -125,32 +169,12 @@ module FastpixClient
|
|
|
125
169
|
rescue StandardError => e
|
|
126
170
|
error = e
|
|
127
171
|
ensure
|
|
128
|
-
|
|
129
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
130
|
-
error: error,
|
|
131
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
132
|
-
hook_ctx: hook_ctx
|
|
133
|
-
),
|
|
134
|
-
response: http_response
|
|
135
|
-
)
|
|
136
|
-
else
|
|
137
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
138
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
139
|
-
hook_ctx: hook_ctx
|
|
140
|
-
),
|
|
141
|
-
response: http_response
|
|
142
|
-
)
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
if http_response.nil?
|
|
146
|
-
raise error if !error.nil?
|
|
147
|
-
raise 'no response'
|
|
148
|
-
end
|
|
172
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
149
173
|
end
|
|
150
174
|
|
|
151
|
-
content_type = http_response.headers.fetch(
|
|
175
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
152
176
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
153
|
-
if Utils.match_content_type(content_type,
|
|
177
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
154
178
|
http_response = @sdk_configuration.hooks.after_success(
|
|
155
179
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
156
180
|
hook_ctx: hook_ctx
|
|
@@ -168,14 +192,14 @@ module FastpixClient
|
|
|
168
192
|
|
|
169
193
|
return response
|
|
170
194
|
else
|
|
171
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
195
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
172
196
|
end
|
|
173
197
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
174
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
198
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
175
199
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
176
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
200
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
177
201
|
else
|
|
178
|
-
if Utils.match_content_type(content_type,
|
|
202
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
179
203
|
http_response = @sdk_configuration.hooks.after_success(
|
|
180
204
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
181
205
|
hook_ctx: hook_ctx
|
|
@@ -193,7 +217,7 @@ module FastpixClient
|
|
|
193
217
|
|
|
194
218
|
return response
|
|
195
219
|
else
|
|
196
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
220
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
197
221
|
end
|
|
198
222
|
end
|
|
199
223
|
end
|
|
@@ -209,11 +233,11 @@ module FastpixClient
|
|
|
209
233
|
# 2. Include the `chapters` parameter in the request body to enable.
|
|
210
234
|
# 3. The response contains the updated media data, confirming the changes made.
|
|
211
235
|
#
|
|
212
|
-
# You can use the <a href="https://
|
|
236
|
+
# You can use the <a href="https://fastpix.com/docs/ai-events/in-video-ai-events#videomediaaichaptersready">video.mediaAI.chapters.ready</a> webhook event to track and notify about the chapters generation.
|
|
213
237
|
#
|
|
214
238
|
# **Use case:** This is particularly useful when a user uploads a video and later decides to enable chapters without re-uploading the entire video.
|
|
215
239
|
#
|
|
216
|
-
# Related guide: <a href="https://
|
|
240
|
+
# Related guide: <a href="https://fastpix.com/docs/video-intelligence/generate-video-chapters">Video chapters</a>
|
|
217
241
|
#
|
|
218
242
|
request = Models::Operations::UpdateMediaChaptersRequest.new(
|
|
219
243
|
media_id: media_id,
|
|
@@ -230,18 +254,10 @@ module FastpixClient
|
|
|
230
254
|
headers = {}
|
|
231
255
|
headers = T.cast(headers, T::Hash[String, String])
|
|
232
256
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
233
|
-
headers[
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
body = Utils.encode_form(form)
|
|
238
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
239
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
240
|
-
else
|
|
241
|
-
body = data
|
|
242
|
-
end
|
|
243
|
-
headers['Accept'] = 'application/json'
|
|
244
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
257
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
258
|
+
body = encode_request_body(req_content_type, data, form)
|
|
259
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
260
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
245
261
|
|
|
246
262
|
security = @sdk_configuration.security_source&.call
|
|
247
263
|
|
|
@@ -280,32 +296,12 @@ module FastpixClient
|
|
|
280
296
|
rescue StandardError => e
|
|
281
297
|
error = e
|
|
282
298
|
ensure
|
|
283
|
-
|
|
284
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
285
|
-
error: error,
|
|
286
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
287
|
-
hook_ctx: hook_ctx
|
|
288
|
-
),
|
|
289
|
-
response: http_response
|
|
290
|
-
)
|
|
291
|
-
else
|
|
292
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
293
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
294
|
-
hook_ctx: hook_ctx
|
|
295
|
-
),
|
|
296
|
-
response: http_response
|
|
297
|
-
)
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
if http_response.nil?
|
|
301
|
-
raise error if !error.nil?
|
|
302
|
-
raise 'no response'
|
|
303
|
-
end
|
|
299
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
304
300
|
end
|
|
305
301
|
|
|
306
|
-
content_type = http_response.headers.fetch(
|
|
302
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
307
303
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
308
|
-
if Utils.match_content_type(content_type,
|
|
304
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
309
305
|
http_response = @sdk_configuration.hooks.after_success(
|
|
310
306
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
311
307
|
hook_ctx: hook_ctx
|
|
@@ -323,14 +319,14 @@ module FastpixClient
|
|
|
323
319
|
|
|
324
320
|
return response
|
|
325
321
|
else
|
|
326
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
322
|
+
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
|
|
327
323
|
end
|
|
328
324
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
329
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
325
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
330
326
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
331
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
327
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
332
328
|
else
|
|
333
|
-
if Utils.match_content_type(content_type,
|
|
329
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
334
330
|
http_response = @sdk_configuration.hooks.after_success(
|
|
335
331
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
336
332
|
hook_ctx: hook_ctx
|
|
@@ -348,7 +344,7 @@ module FastpixClient
|
|
|
348
344
|
|
|
349
345
|
return response
|
|
350
346
|
else
|
|
351
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
347
|
+
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
|
|
352
348
|
end
|
|
353
349
|
end
|
|
354
350
|
end
|
|
@@ -369,11 +365,11 @@ module FastpixClient
|
|
|
369
365
|
# 2. Include the `namedEntities` parameter in the request body to enable.
|
|
370
366
|
# 3. Receive a response containing the updated media data, confirming the changes made.
|
|
371
367
|
#
|
|
372
|
-
# You can use the <a href="https://
|
|
368
|
+
# You can use the <a href="https://fastpix.com/docs/ai-events/in-video-ai-events#videomediaainamedentitiesready">video.mediaAI.named-entities.ready</a> webhook event to track and notify about the named entities extraction.
|
|
373
369
|
#
|
|
374
370
|
# **Use case:** If a user uploads a video and later decides to enable named entity extraction without re-uploading the entire video.
|
|
375
371
|
#
|
|
376
|
-
# Related guide: <a href="https://
|
|
372
|
+
# Related guide: <a href="https://fastpix.com/docs/video-intelligence/extract-named-entities-from-a-video">Named entities</a>
|
|
377
373
|
#
|
|
378
374
|
request = Models::Operations::UpdateMediaNamedEntitiesRequest.new(
|
|
379
375
|
media_id: media_id,
|
|
@@ -390,18 +386,10 @@ module FastpixClient
|
|
|
390
386
|
headers = {}
|
|
391
387
|
headers = T.cast(headers, T::Hash[String, String])
|
|
392
388
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
393
|
-
headers[
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
body = Utils.encode_form(form)
|
|
398
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
399
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
400
|
-
else
|
|
401
|
-
body = data
|
|
402
|
-
end
|
|
403
|
-
headers['Accept'] = 'application/json'
|
|
404
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
389
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
390
|
+
body = encode_request_body(req_content_type, data, form)
|
|
391
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
392
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
405
393
|
|
|
406
394
|
security = @sdk_configuration.security_source&.call
|
|
407
395
|
|
|
@@ -440,32 +428,12 @@ module FastpixClient
|
|
|
440
428
|
rescue StandardError => e
|
|
441
429
|
error = e
|
|
442
430
|
ensure
|
|
443
|
-
|
|
444
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
445
|
-
error: error,
|
|
446
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
447
|
-
hook_ctx: hook_ctx
|
|
448
|
-
),
|
|
449
|
-
response: http_response
|
|
450
|
-
)
|
|
451
|
-
else
|
|
452
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
453
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
454
|
-
hook_ctx: hook_ctx
|
|
455
|
-
),
|
|
456
|
-
response: http_response
|
|
457
|
-
)
|
|
458
|
-
end
|
|
459
|
-
|
|
460
|
-
if http_response.nil?
|
|
461
|
-
raise error if !error.nil?
|
|
462
|
-
raise 'no response'
|
|
463
|
-
end
|
|
431
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
464
432
|
end
|
|
465
433
|
|
|
466
|
-
content_type = http_response.headers.fetch(
|
|
434
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
467
435
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
468
|
-
if Utils.match_content_type(content_type,
|
|
436
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
469
437
|
http_response = @sdk_configuration.hooks.after_success(
|
|
470
438
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
471
439
|
hook_ctx: hook_ctx
|
|
@@ -483,14 +451,14 @@ module FastpixClient
|
|
|
483
451
|
|
|
484
452
|
return response
|
|
485
453
|
else
|
|
486
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
454
|
+
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
|
|
487
455
|
end
|
|
488
456
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
489
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
457
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
490
458
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
491
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
459
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
492
460
|
else
|
|
493
|
-
if Utils.match_content_type(content_type,
|
|
461
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
494
462
|
http_response = @sdk_configuration.hooks.after_success(
|
|
495
463
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
496
464
|
hook_ctx: hook_ctx
|
|
@@ -508,7 +476,7 @@ module FastpixClient
|
|
|
508
476
|
|
|
509
477
|
return response
|
|
510
478
|
else
|
|
511
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
479
|
+
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
|
|
512
480
|
end
|
|
513
481
|
end
|
|
514
482
|
end
|
|
@@ -524,11 +492,11 @@ module FastpixClient
|
|
|
524
492
|
# 2. Include the `moderation` object and provide the requried `type` parameter in the request body to specify the media type (for example, video/audio/av).
|
|
525
493
|
# 4. The response contains the updated media data, confirming the changes made.
|
|
526
494
|
#
|
|
527
|
-
# You can use the <a href="https://
|
|
495
|
+
# You can use the <a href="https://fastpix.com/docs/ai-events/in-video-ai-events#videomediaaimoderationready">video.mediaAI.moderation.ready</a> webhook event to track and notify about the detected moderation results.
|
|
528
496
|
#
|
|
529
497
|
# **Use case:** This is particularly useful when a user uploads a video and later decides to enable moderation detection without the need to re-upload it.
|
|
530
498
|
#
|
|
531
|
-
# Related guide: <a href="https://
|
|
499
|
+
# Related guide: <a href="https://fastpix.com/docs/video-intelligence/detect-nsfw-content-and-profanity">Moderate NSFW & Profanity</a>
|
|
532
500
|
#
|
|
533
501
|
request = Models::Operations::UpdateMediaModerationRequest.new(
|
|
534
502
|
media_id: media_id,
|
|
@@ -545,18 +513,10 @@ module FastpixClient
|
|
|
545
513
|
headers = {}
|
|
546
514
|
headers = T.cast(headers, T::Hash[String, String])
|
|
547
515
|
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
548
|
-
headers[
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
body = Utils.encode_form(form)
|
|
553
|
-
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
554
|
-
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
555
|
-
else
|
|
556
|
-
body = data
|
|
557
|
-
end
|
|
558
|
-
headers['Accept'] = 'application/json'
|
|
559
|
-
headers['user-agent'] = @sdk_configuration.user_agent
|
|
516
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
517
|
+
body = encode_request_body(req_content_type, data, form)
|
|
518
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
519
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
560
520
|
|
|
561
521
|
security = @sdk_configuration.security_source&.call
|
|
562
522
|
|
|
@@ -595,32 +555,12 @@ module FastpixClient
|
|
|
595
555
|
rescue StandardError => e
|
|
596
556
|
error = e
|
|
597
557
|
ensure
|
|
598
|
-
|
|
599
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
600
|
-
error: error,
|
|
601
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
602
|
-
hook_ctx: hook_ctx
|
|
603
|
-
),
|
|
604
|
-
response: http_response
|
|
605
|
-
)
|
|
606
|
-
else
|
|
607
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
608
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
609
|
-
hook_ctx: hook_ctx
|
|
610
|
-
),
|
|
611
|
-
response: http_response
|
|
612
|
-
)
|
|
613
|
-
end
|
|
614
|
-
|
|
615
|
-
if http_response.nil?
|
|
616
|
-
raise error if !error.nil?
|
|
617
|
-
raise 'no response'
|
|
618
|
-
end
|
|
558
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
619
559
|
end
|
|
620
560
|
|
|
621
|
-
content_type = http_response.headers.fetch(
|
|
561
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
622
562
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
623
|
-
if Utils.match_content_type(content_type,
|
|
563
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
624
564
|
http_response = @sdk_configuration.hooks.after_success(
|
|
625
565
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
626
566
|
hook_ctx: hook_ctx
|
|
@@ -638,14 +578,14 @@ module FastpixClient
|
|
|
638
578
|
|
|
639
579
|
return response
|
|
640
580
|
else
|
|
641
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
581
|
+
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
|
|
642
582
|
end
|
|
643
583
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
644
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
584
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
645
585
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
646
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
586
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
647
587
|
else
|
|
648
|
-
if Utils.match_content_type(content_type,
|
|
588
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
649
589
|
http_response = @sdk_configuration.hooks.after_success(
|
|
650
590
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
651
591
|
hook_ctx: hook_ctx
|
|
@@ -663,7 +603,7 @@ module FastpixClient
|
|
|
663
603
|
|
|
664
604
|
return response
|
|
665
605
|
else
|
|
666
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
606
|
+
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
|
|
667
607
|
end
|
|
668
608
|
end
|
|
669
609
|
end
|