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,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
|
|
@@ -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
|
|
@@ -502,24 +495,16 @@ module FastpixClient
|
|
|
502
495
|
url = Utils.generate_url(
|
|
503
496
|
Models::Operations::UpdatedMediaRequest,
|
|
504
497
|
base_url,
|
|
505
|
-
|
|
498
|
+
MEDIA_PATH,
|
|
506
499
|
request
|
|
507
500
|
)
|
|
508
501
|
headers = {}
|
|
509
502
|
headers = T.cast(headers, T::Hash[String, String])
|
|
510
503
|
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
|
|
504
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
505
|
+
body = encode_request_body(req_content_type, data, form)
|
|
506
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
507
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
523
508
|
|
|
524
509
|
security = @sdk_configuration.security_source&.call
|
|
525
510
|
|
|
@@ -558,32 +543,12 @@ module FastpixClient
|
|
|
558
543
|
rescue StandardError => e
|
|
559
544
|
error = e
|
|
560
545
|
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
|
|
546
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
582
547
|
end
|
|
583
548
|
|
|
584
|
-
content_type = http_response.headers.fetch(
|
|
549
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
585
550
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
586
|
-
if Utils.match_content_type(content_type,
|
|
551
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
587
552
|
http_response = @sdk_configuration.hooks.after_success(
|
|
588
553
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
589
554
|
hook_ctx: hook_ctx
|
|
@@ -601,14 +566,14 @@ module FastpixClient
|
|
|
601
566
|
|
|
602
567
|
return response
|
|
603
568
|
else
|
|
604
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
569
|
+
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
570
|
end
|
|
606
571
|
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),
|
|
572
|
+
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
573
|
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),
|
|
574
|
+
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
575
|
else
|
|
611
|
-
if Utils.match_content_type(content_type,
|
|
576
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
612
577
|
http_response = @sdk_configuration.hooks.after_success(
|
|
613
578
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
614
579
|
hook_ctx: hook_ctx
|
|
@@ -626,7 +591,7 @@ module FastpixClient
|
|
|
626
591
|
|
|
627
592
|
return response
|
|
628
593
|
else
|
|
629
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
594
|
+
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
595
|
end
|
|
631
596
|
end
|
|
632
597
|
end
|
|
@@ -658,13 +623,13 @@ module FastpixClient
|
|
|
658
623
|
url = Utils.generate_url(
|
|
659
624
|
Models::Operations::DeleteMediaRequest,
|
|
660
625
|
base_url,
|
|
661
|
-
|
|
626
|
+
MEDIA_PATH,
|
|
662
627
|
request
|
|
663
628
|
)
|
|
664
629
|
headers = {}
|
|
665
630
|
headers = T.cast(headers, T::Hash[String, String])
|
|
666
|
-
headers['Accept'] =
|
|
667
|
-
headers[
|
|
631
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
632
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
668
633
|
|
|
669
634
|
security = @sdk_configuration.security_source&.call
|
|
670
635
|
|
|
@@ -702,32 +667,12 @@ module FastpixClient
|
|
|
702
667
|
rescue StandardError => e
|
|
703
668
|
error = e
|
|
704
669
|
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
|
|
670
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
726
671
|
end
|
|
727
672
|
|
|
728
|
-
content_type = http_response.headers.fetch(
|
|
673
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
729
674
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
730
|
-
if Utils.match_content_type(content_type,
|
|
675
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
731
676
|
http_response = @sdk_configuration.hooks.after_success(
|
|
732
677
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
733
678
|
hook_ctx: hook_ctx
|
|
@@ -745,14 +690,14 @@ module FastpixClient
|
|
|
745
690
|
|
|
746
691
|
return response
|
|
747
692
|
else
|
|
748
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
693
|
+
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
694
|
end
|
|
750
695
|
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),
|
|
696
|
+
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
697
|
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),
|
|
698
|
+
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
699
|
else
|
|
755
|
-
if Utils.match_content_type(content_type,
|
|
700
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
756
701
|
http_response = @sdk_configuration.hooks.after_success(
|
|
757
702
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
758
703
|
hook_ctx: hook_ctx
|
|
@@ -770,7 +715,7 @@ module FastpixClient
|
|
|
770
715
|
|
|
771
716
|
return response
|
|
772
717
|
else
|
|
773
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
718
|
+
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
719
|
end
|
|
775
720
|
end
|
|
776
721
|
end
|
|
@@ -820,18 +765,10 @@ module FastpixClient
|
|
|
820
765
|
headers = {}
|
|
821
766
|
headers = T.cast(headers, T::Hash[String, String])
|
|
822
767
|
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
|
|
768
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
769
|
+
body = encode_request_body(req_content_type, data, form)
|
|
770
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
771
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
835
772
|
|
|
836
773
|
security = @sdk_configuration.security_source&.call
|
|
837
774
|
|
|
@@ -870,32 +807,12 @@ module FastpixClient
|
|
|
870
807
|
rescue StandardError => e
|
|
871
808
|
error = e
|
|
872
809
|
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
|
|
810
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
894
811
|
end
|
|
895
812
|
|
|
896
|
-
content_type = http_response.headers.fetch(
|
|
813
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
897
814
|
if Utils.match_status_code(http_response.status, ['201'])
|
|
898
|
-
if Utils.match_content_type(content_type,
|
|
815
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
899
816
|
http_response = @sdk_configuration.hooks.after_success(
|
|
900
817
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
901
818
|
hook_ctx: hook_ctx
|
|
@@ -913,14 +830,14 @@ module FastpixClient
|
|
|
913
830
|
|
|
914
831
|
return response
|
|
915
832
|
else
|
|
916
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
833
|
+
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
834
|
end
|
|
918
835
|
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),
|
|
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
|
|
920
837
|
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),
|
|
838
|
+
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
839
|
else
|
|
923
|
-
if Utils.match_content_type(content_type,
|
|
840
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
924
841
|
http_response = @sdk_configuration.hooks.after_success(
|
|
925
842
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
926
843
|
hook_ctx: hook_ctx
|
|
@@ -938,7 +855,7 @@ module FastpixClient
|
|
|
938
855
|
|
|
939
856
|
return response
|
|
940
857
|
else
|
|
941
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
858
|
+
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
859
|
end
|
|
943
860
|
end
|
|
944
861
|
end
|
|
@@ -975,8 +892,8 @@ module FastpixClient
|
|
|
975
892
|
)
|
|
976
893
|
headers = {}
|
|
977
894
|
headers = T.cast(headers, T::Hash[String, String])
|
|
978
|
-
headers['Accept'] =
|
|
979
|
-
headers[
|
|
895
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
896
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
980
897
|
|
|
981
898
|
security = @sdk_configuration.security_source&.call
|
|
982
899
|
|
|
@@ -1014,32 +931,12 @@ module FastpixClient
|
|
|
1014
931
|
rescue StandardError => e
|
|
1015
932
|
error = e
|
|
1016
933
|
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
|
|
934
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1038
935
|
end
|
|
1039
936
|
|
|
1040
|
-
content_type = http_response.headers.fetch(
|
|
937
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1041
938
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1042
|
-
if Utils.match_content_type(content_type,
|
|
939
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1043
940
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1044
941
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1045
942
|
hook_ctx: hook_ctx
|
|
@@ -1057,14 +954,14 @@ module FastpixClient
|
|
|
1057
954
|
|
|
1058
955
|
return response
|
|
1059
956
|
else
|
|
1060
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
957
|
+
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
958
|
end
|
|
1062
959
|
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),
|
|
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
|
|
1064
961
|
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),
|
|
962
|
+
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
963
|
else
|
|
1067
|
-
if Utils.match_content_type(content_type,
|
|
964
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1068
965
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1069
966
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1070
967
|
hook_ctx: hook_ctx
|
|
@@ -1082,7 +979,7 @@ module FastpixClient
|
|
|
1082
979
|
|
|
1083
980
|
return response
|
|
1084
981
|
else
|
|
1085
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
982
|
+
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
983
|
end
|
|
1087
984
|
end
|
|
1088
985
|
end
|
|
@@ -1137,18 +1034,10 @@ module FastpixClient
|
|
|
1137
1034
|
headers = {}
|
|
1138
1035
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1139
1036
|
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
|
|
1037
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1038
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1039
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1040
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1152
1041
|
|
|
1153
1042
|
security = @sdk_configuration.security_source&.call
|
|
1154
1043
|
|
|
@@ -1187,32 +1076,12 @@ module FastpixClient
|
|
|
1187
1076
|
rescue StandardError => e
|
|
1188
1077
|
error = e
|
|
1189
1078
|
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
|
|
1079
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1211
1080
|
end
|
|
1212
1081
|
|
|
1213
|
-
content_type = http_response.headers.fetch(
|
|
1082
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1214
1083
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1215
|
-
if Utils.match_content_type(content_type,
|
|
1084
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1216
1085
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1217
1086
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1218
1087
|
hook_ctx: hook_ctx
|
|
@@ -1230,14 +1099,14 @@ module FastpixClient
|
|
|
1230
1099
|
|
|
1231
1100
|
return response
|
|
1232
1101
|
else
|
|
1233
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1102
|
+
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
1103
|
end
|
|
1235
1104
|
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),
|
|
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
|
|
1237
1106
|
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),
|
|
1107
|
+
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
1108
|
else
|
|
1240
|
-
if Utils.match_content_type(content_type,
|
|
1109
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1241
1110
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1242
1111
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1243
1112
|
hook_ctx: hook_ctx
|
|
@@ -1255,7 +1124,7 @@ module FastpixClient
|
|
|
1255
1124
|
|
|
1256
1125
|
return response
|
|
1257
1126
|
else
|
|
1258
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1127
|
+
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
1128
|
end
|
|
1260
1129
|
end
|
|
1261
1130
|
end
|
|
@@ -1304,8 +1173,8 @@ module FastpixClient
|
|
|
1304
1173
|
)
|
|
1305
1174
|
headers = {}
|
|
1306
1175
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1307
|
-
headers['Accept'] =
|
|
1308
|
-
headers[
|
|
1176
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1177
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1309
1178
|
|
|
1310
1179
|
security = @sdk_configuration.security_source&.call
|
|
1311
1180
|
|
|
@@ -1343,32 +1212,12 @@ module FastpixClient
|
|
|
1343
1212
|
rescue StandardError => e
|
|
1344
1213
|
error = e
|
|
1345
1214
|
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
|
|
1215
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1367
1216
|
end
|
|
1368
1217
|
|
|
1369
|
-
content_type = http_response.headers.fetch(
|
|
1218
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1370
1219
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1371
|
-
if Utils.match_content_type(content_type,
|
|
1220
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1372
1221
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1373
1222
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1374
1223
|
hook_ctx: hook_ctx
|
|
@@ -1386,14 +1235,14 @@ module FastpixClient
|
|
|
1386
1235
|
|
|
1387
1236
|
return response
|
|
1388
1237
|
else
|
|
1389
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1238
|
+
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
1239
|
end
|
|
1391
1240
|
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),
|
|
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
|
|
1393
1242
|
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),
|
|
1243
|
+
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
1244
|
else
|
|
1396
|
-
if Utils.match_content_type(content_type,
|
|
1245
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1397
1246
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1398
1247
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1399
1248
|
hook_ctx: hook_ctx
|
|
@@ -1411,7 +1260,7 @@ module FastpixClient
|
|
|
1411
1260
|
|
|
1412
1261
|
return response
|
|
1413
1262
|
else
|
|
1414
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1263
|
+
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
1264
|
end
|
|
1416
1265
|
end
|
|
1417
1266
|
end
|
|
@@ -1454,18 +1303,10 @@ module FastpixClient
|
|
|
1454
1303
|
headers = {}
|
|
1455
1304
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1456
1305
|
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
|
|
1306
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1307
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1308
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1309
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1469
1310
|
|
|
1470
1311
|
security = @sdk_configuration.security_source&.call
|
|
1471
1312
|
|
|
@@ -1504,32 +1345,12 @@ module FastpixClient
|
|
|
1504
1345
|
rescue StandardError => e
|
|
1505
1346
|
error = e
|
|
1506
1347
|
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
|
|
1348
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1528
1349
|
end
|
|
1529
1350
|
|
|
1530
|
-
content_type = http_response.headers.fetch(
|
|
1351
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1531
1352
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1532
|
-
if Utils.match_content_type(content_type,
|
|
1353
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1533
1354
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1534
1355
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1535
1356
|
hook_ctx: hook_ctx
|
|
@@ -1547,14 +1368,14 @@ module FastpixClient
|
|
|
1547
1368
|
|
|
1548
1369
|
return response
|
|
1549
1370
|
else
|
|
1550
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1371
|
+
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
1372
|
end
|
|
1552
1373
|
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),
|
|
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
|
|
1554
1375
|
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),
|
|
1376
|
+
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
1377
|
else
|
|
1557
|
-
if Utils.match_content_type(content_type,
|
|
1378
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1558
1379
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1559
1380
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1560
1381
|
hook_ctx: hook_ctx
|
|
@@ -1572,7 +1393,7 @@ module FastpixClient
|
|
|
1572
1393
|
|
|
1573
1394
|
return response
|
|
1574
1395
|
else
|
|
1575
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1396
|
+
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
1397
|
end
|
|
1577
1398
|
end
|
|
1578
1399
|
end
|
|
@@ -1607,8 +1428,8 @@ module FastpixClient
|
|
|
1607
1428
|
)
|
|
1608
1429
|
headers = {}
|
|
1609
1430
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1610
|
-
headers['Accept'] =
|
|
1611
|
-
headers[
|
|
1431
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1432
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1612
1433
|
|
|
1613
1434
|
security = @sdk_configuration.security_source&.call
|
|
1614
1435
|
|
|
@@ -1646,32 +1467,12 @@ module FastpixClient
|
|
|
1646
1467
|
rescue StandardError => e
|
|
1647
1468
|
error = e
|
|
1648
1469
|
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
|
|
1470
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1670
1471
|
end
|
|
1671
1472
|
|
|
1672
|
-
content_type = http_response.headers.fetch(
|
|
1473
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1673
1474
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1674
|
-
if Utils.match_content_type(content_type,
|
|
1475
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1675
1476
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1676
1477
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1677
1478
|
hook_ctx: hook_ctx
|
|
@@ -1689,14 +1490,14 @@ module FastpixClient
|
|
|
1689
1490
|
|
|
1690
1491
|
return response
|
|
1691
1492
|
else
|
|
1692
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1493
|
+
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
1494
|
end
|
|
1694
1495
|
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),
|
|
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
|
|
1696
1497
|
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),
|
|
1498
|
+
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
1499
|
else
|
|
1699
|
-
if Utils.match_content_type(content_type,
|
|
1500
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1700
1501
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1701
1502
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1702
1503
|
hook_ctx: hook_ctx
|
|
@@ -1714,7 +1515,7 @@ module FastpixClient
|
|
|
1714
1515
|
|
|
1715
1516
|
return response
|
|
1716
1517
|
else
|
|
1717
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1518
|
+
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
1519
|
end
|
|
1719
1520
|
end
|
|
1720
1521
|
end
|
|
@@ -1749,18 +1550,10 @@ module FastpixClient
|
|
|
1749
1550
|
headers = {}
|
|
1750
1551
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1751
1552
|
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
|
|
1553
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1554
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1555
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1556
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1764
1557
|
|
|
1765
1558
|
security = @sdk_configuration.security_source&.call
|
|
1766
1559
|
|
|
@@ -1799,32 +1592,12 @@ module FastpixClient
|
|
|
1799
1592
|
rescue StandardError => e
|
|
1800
1593
|
error = e
|
|
1801
1594
|
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
|
|
1595
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1823
1596
|
end
|
|
1824
1597
|
|
|
1825
|
-
content_type = http_response.headers.fetch(
|
|
1598
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1826
1599
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1827
|
-
if Utils.match_content_type(content_type,
|
|
1600
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1828
1601
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1829
1602
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1830
1603
|
hook_ctx: hook_ctx
|
|
@@ -1842,14 +1615,14 @@ module FastpixClient
|
|
|
1842
1615
|
|
|
1843
1616
|
return response
|
|
1844
1617
|
else
|
|
1845
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1618
|
+
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
1619
|
end
|
|
1847
1620
|
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),
|
|
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
|
|
1849
1622
|
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),
|
|
1623
|
+
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
1624
|
else
|
|
1852
|
-
if Utils.match_content_type(content_type,
|
|
1625
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
1853
1626
|
http_response = @sdk_configuration.hooks.after_success(
|
|
1854
1627
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1855
1628
|
hook_ctx: hook_ctx
|
|
@@ -1867,7 +1640,7 @@ module FastpixClient
|
|
|
1867
1640
|
|
|
1868
1641
|
return response
|
|
1869
1642
|
else
|
|
1870
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1643
|
+
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
1644
|
end
|
|
1872
1645
|
end
|
|
1873
1646
|
end
|
|
@@ -1921,18 +1694,10 @@ module FastpixClient
|
|
|
1921
1694
|
headers = {}
|
|
1922
1695
|
headers = T.cast(headers, T::Hash[String, String])
|
|
1923
1696
|
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
|
|
1697
|
+
headers[REQUEST_CONTENT_TYPE_HEADER] = req_content_type
|
|
1698
|
+
body = encode_request_body(req_content_type, data, form)
|
|
1699
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1700
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
1936
1701
|
|
|
1937
1702
|
security = @sdk_configuration.security_source&.call
|
|
1938
1703
|
|
|
@@ -1971,32 +1736,12 @@ module FastpixClient
|
|
|
1971
1736
|
rescue StandardError => e
|
|
1972
1737
|
error = e
|
|
1973
1738
|
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
|
|
1739
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
1995
1740
|
end
|
|
1996
1741
|
|
|
1997
|
-
content_type = http_response.headers.fetch(
|
|
1742
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
1998
1743
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
1999
|
-
if Utils.match_content_type(content_type,
|
|
1744
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2000
1745
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2001
1746
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2002
1747
|
hook_ctx: hook_ctx
|
|
@@ -2014,14 +1759,14 @@ module FastpixClient
|
|
|
2014
1759
|
|
|
2015
1760
|
return response
|
|
2016
1761
|
else
|
|
2017
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1762
|
+
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
1763
|
end
|
|
2019
1764
|
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),
|
|
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
|
|
2021
1766
|
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),
|
|
1767
|
+
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
1768
|
else
|
|
2024
|
-
if Utils.match_content_type(content_type,
|
|
1769
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2025
1770
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2026
1771
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2027
1772
|
hook_ctx: hook_ctx
|
|
@@ -2039,7 +1784,7 @@ module FastpixClient
|
|
|
2039
1784
|
|
|
2040
1785
|
return response
|
|
2041
1786
|
else
|
|
2042
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1787
|
+
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
1788
|
end
|
|
2044
1789
|
end
|
|
2045
1790
|
end
|
|
@@ -2076,8 +1821,8 @@ module FastpixClient
|
|
|
2076
1821
|
)
|
|
2077
1822
|
headers = {}
|
|
2078
1823
|
headers = T.cast(headers, T::Hash[String, String])
|
|
2079
|
-
headers['Accept'] =
|
|
2080
|
-
headers[
|
|
1824
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1825
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
2081
1826
|
|
|
2082
1827
|
security = @sdk_configuration.security_source&.call
|
|
2083
1828
|
|
|
@@ -2115,32 +1860,12 @@ module FastpixClient
|
|
|
2115
1860
|
rescue StandardError => e
|
|
2116
1861
|
error = e
|
|
2117
1862
|
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
|
|
1863
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
2139
1864
|
end
|
|
2140
1865
|
|
|
2141
|
-
content_type = http_response.headers.fetch(
|
|
1866
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
2142
1867
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
2143
|
-
if Utils.match_content_type(content_type,
|
|
1868
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2144
1869
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2145
1870
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2146
1871
|
hook_ctx: hook_ctx
|
|
@@ -2158,14 +1883,14 @@ module FastpixClient
|
|
|
2158
1883
|
|
|
2159
1884
|
return response
|
|
2160
1885
|
else
|
|
2161
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1886
|
+
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
1887
|
end
|
|
2163
1888
|
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),
|
|
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
|
|
2165
1890
|
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),
|
|
1891
|
+
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
1892
|
else
|
|
2168
|
-
if Utils.match_content_type(content_type,
|
|
1893
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2169
1894
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2170
1895
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2171
1896
|
hook_ctx: hook_ctx
|
|
@@ -2183,7 +1908,7 @@ module FastpixClient
|
|
|
2183
1908
|
|
|
2184
1909
|
return response
|
|
2185
1910
|
else
|
|
2186
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
1911
|
+
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
1912
|
end
|
|
2188
1913
|
end
|
|
2189
1914
|
end
|
|
@@ -2220,8 +1945,8 @@ module FastpixClient
|
|
|
2220
1945
|
headers = {}
|
|
2221
1946
|
headers = T.cast(headers, T::Hash[String, String])
|
|
2222
1947
|
query_params = Utils.get_query_params(Models::Operations::ListUploadsRequest, request, nil)
|
|
2223
|
-
headers['Accept'] =
|
|
2224
|
-
headers[
|
|
1948
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
1949
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
2225
1950
|
|
|
2226
1951
|
security = @sdk_configuration.security_source&.call
|
|
2227
1952
|
|
|
@@ -2260,32 +1985,12 @@ module FastpixClient
|
|
|
2260
1985
|
rescue StandardError => e
|
|
2261
1986
|
error = e
|
|
2262
1987
|
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
|
|
1988
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
2284
1989
|
end
|
|
2285
1990
|
|
|
2286
|
-
content_type = http_response.headers.fetch(
|
|
1991
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
2287
1992
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
2288
|
-
if Utils.match_content_type(content_type,
|
|
1993
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2289
1994
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2290
1995
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2291
1996
|
hook_ctx: hook_ctx
|
|
@@ -2303,14 +2008,14 @@ module FastpixClient
|
|
|
2303
2008
|
|
|
2304
2009
|
return response
|
|
2305
2010
|
else
|
|
2306
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2011
|
+
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
2012
|
end
|
|
2308
2013
|
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),
|
|
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
|
|
2310
2015
|
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),
|
|
2016
|
+
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
2017
|
else
|
|
2313
|
-
if Utils.match_content_type(content_type,
|
|
2018
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2314
2019
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2315
2020
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2316
2021
|
hook_ctx: hook_ctx
|
|
@@ -2328,7 +2033,7 @@ module FastpixClient
|
|
|
2328
2033
|
|
|
2329
2034
|
return response
|
|
2330
2035
|
else
|
|
2331
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2036
|
+
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
2037
|
end
|
|
2333
2038
|
end
|
|
2334
2039
|
end
|
|
@@ -2373,8 +2078,8 @@ module FastpixClient
|
|
|
2373
2078
|
headers = {}
|
|
2374
2079
|
headers = T.cast(headers, T::Hash[String, String])
|
|
2375
2080
|
query_params = Utils.get_query_params(Models::Operations::GetMediaClipsRequest, request, nil)
|
|
2376
|
-
headers['Accept'] =
|
|
2377
|
-
headers[
|
|
2081
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
2082
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
2378
2083
|
|
|
2379
2084
|
security = @sdk_configuration.security_source&.call
|
|
2380
2085
|
|
|
@@ -2413,32 +2118,12 @@ module FastpixClient
|
|
|
2413
2118
|
rescue StandardError => e
|
|
2414
2119
|
error = e
|
|
2415
2120
|
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
|
|
2121
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
2437
2122
|
end
|
|
2438
2123
|
|
|
2439
|
-
content_type = http_response.headers.fetch(
|
|
2124
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
2440
2125
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
2441
|
-
if Utils.match_content_type(content_type,
|
|
2126
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2442
2127
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2443
2128
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2444
2129
|
hook_ctx: hook_ctx
|
|
@@ -2456,14 +2141,14 @@ module FastpixClient
|
|
|
2456
2141
|
|
|
2457
2142
|
return response
|
|
2458
2143
|
else
|
|
2459
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2144
|
+
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
2145
|
end
|
|
2461
2146
|
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),
|
|
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
|
|
2463
2148
|
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),
|
|
2149
|
+
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
2150
|
else
|
|
2466
|
-
if Utils.match_content_type(content_type,
|
|
2151
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
2467
2152
|
http_response = @sdk_configuration.hooks.after_success(
|
|
2468
2153
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2469
2154
|
hook_ctx: hook_ctx
|
|
@@ -2481,7 +2166,7 @@ module FastpixClient
|
|
|
2481
2166
|
|
|
2482
2167
|
return response
|
|
2483
2168
|
else
|
|
2484
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
2169
|
+
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
2170
|
end
|
|
2486
2171
|
end
|
|
2487
2172
|
end
|