mirror of
https://github.com/LukeHagar/plexruby.git
synced 2025-12-06 20:57:45 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.531.4
This commit is contained in:
@@ -33,12 +33,12 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(type: ::PlexRubySDK::Operations::GetTransientTokenQueryParamType, scope: ::PlexRubySDK::Operations::Scope, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetTransientTokenResponse) }
|
||||
sig { params(type: Models::Operations::GetTransientTokenQueryParamType, scope: Models::Operations::Scope, timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetTransientTokenResponse) }
|
||||
def get_transient_token(type, scope, timeout_ms = nil)
|
||||
# get_transient_token - Get a Transient Token
|
||||
# This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.
|
||||
#
|
||||
request = ::PlexRubySDK::Operations::GetTransientTokenRequest.new(
|
||||
request = Models::Operations::GetTransientTokenRequest.new(
|
||||
|
||||
type: type,
|
||||
scope: scope
|
||||
@@ -47,7 +47,7 @@ module PlexRubySDK
|
||||
base_url = Utils.template_url(url, params)
|
||||
url = "#{base_url}/security/token"
|
||||
headers = {}
|
||||
query_params = Utils.get_query_params(::PlexRubySDK::Operations::GetTransientTokenRequest, request)
|
||||
query_params = Utils.get_query_params(Models::Operations::GetTransientTokenRequest, request)
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
@@ -66,10 +66,11 @@ module PlexRubySDK
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
http_response = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
|
||||
begin
|
||||
r = connection.get(url) do |req|
|
||||
http_response = connection.get(url) do |req|
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
req.params = query_params
|
||||
@@ -85,58 +86,88 @@ module PlexRubySDK
|
||||
rescue StandardError => e
|
||||
error = e
|
||||
ensure
|
||||
if r.nil? || Utils.error_status?(r.status)
|
||||
r = @sdk_configuration.hooks.after_error(
|
||||
if http_response.nil? || Utils.error_status?(http_response.status)
|
||||
http_response = @sdk_configuration.hooks.after_error(
|
||||
error: error,
|
||||
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
else
|
||||
r = @sdk_configuration.hooks.after_success(
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
end
|
||||
|
||||
if r.nil?
|
||||
if http_response.nil?
|
||||
raise error if !error.nil?
|
||||
raise 'no response'
|
||||
end
|
||||
end
|
||||
|
||||
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
|
||||
res = ::PlexRubySDK::Operations::GetTransientTokenResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if r.status == 200
|
||||
elsif r.status == 400
|
||||
|
||||
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
if Utils.match_status_code(http_response.status, ['200'])
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
return Models::Operations::GetTransientTokenResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response
|
||||
)
|
||||
elsif Utils.match_status_code(http_response.status, ['400'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetTransientTokenBadRequest)
|
||||
res.bad_request = out
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::GetTransientTokenBadRequest)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif r.status == 401
|
||||
elsif Utils.match_status_code(http_response.status, ['401'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetTransientTokenUnauthorized)
|
||||
res.unauthorized = out
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::GetTransientTokenUnauthorized)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
||||
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(source: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetSourceConnectionInformationResponse) }
|
||||
sig { params(source: ::String, timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetSourceConnectionInformationResponse) }
|
||||
def get_source_connection_information(source, timeout_ms = nil)
|
||||
# get_source_connection_information - Get Source Connection Information
|
||||
# If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
|
||||
# Note: requires Plex Media Server >= 1.15.4.
|
||||
#
|
||||
request = ::PlexRubySDK::Operations::GetSourceConnectionInformationRequest.new(
|
||||
request = Models::Operations::GetSourceConnectionInformationRequest.new(
|
||||
|
||||
source: source
|
||||
)
|
||||
@@ -144,7 +175,7 @@ module PlexRubySDK
|
||||
base_url = Utils.template_url(url, params)
|
||||
url = "#{base_url}/security/resources"
|
||||
headers = {}
|
||||
query_params = Utils.get_query_params(::PlexRubySDK::Operations::GetSourceConnectionInformationRequest, request)
|
||||
query_params = Utils.get_query_params(Models::Operations::GetSourceConnectionInformationRequest, request)
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
@@ -163,10 +194,11 @@ module PlexRubySDK
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
http_response = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
|
||||
begin
|
||||
r = connection.get(url) do |req|
|
||||
http_response = connection.get(url) do |req|
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
req.params = query_params
|
||||
@@ -182,52 +214,82 @@ module PlexRubySDK
|
||||
rescue StandardError => e
|
||||
error = e
|
||||
ensure
|
||||
if r.nil? || Utils.error_status?(r.status)
|
||||
r = @sdk_configuration.hooks.after_error(
|
||||
if http_response.nil? || Utils.error_status?(http_response.status)
|
||||
http_response = @sdk_configuration.hooks.after_error(
|
||||
error: error,
|
||||
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
else
|
||||
r = @sdk_configuration.hooks.after_success(
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
end
|
||||
|
||||
if r.nil?
|
||||
if http_response.nil?
|
||||
raise error if !error.nil?
|
||||
raise 'no response'
|
||||
end
|
||||
end
|
||||
|
||||
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
|
||||
res = ::PlexRubySDK::Operations::GetSourceConnectionInformationResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if r.status == 200
|
||||
elsif r.status == 400
|
||||
|
||||
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
if Utils.match_status_code(http_response.status, ['200'])
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
return Models::Operations::GetSourceConnectionInformationResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response
|
||||
)
|
||||
elsif Utils.match_status_code(http_response.status, ['400'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetSourceConnectionInformationBadRequest)
|
||||
res.bad_request = out
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::GetSourceConnectionInformationBadRequest)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif r.status == 401
|
||||
elsif Utils.match_status_code(http_response.status, ['401'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetSourceConnectionInformationUnauthorized)
|
||||
res.unauthorized = out
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::GetSourceConnectionInformationUnauthorized)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
||||
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetTokenDetailsResponse) }
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetTokenDetailsResponse) }
|
||||
def get_token_details(server_url = nil, timeout_ms = nil)
|
||||
# get_token_details - Get Token Details
|
||||
# Get the User data from the provided X-Plex-Token
|
||||
@@ -254,10 +316,11 @@ module PlexRubySDK
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
http_response = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
|
||||
begin
|
||||
r = connection.get(url) do |req|
|
||||
http_response = connection.get(url) do |req|
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
Utils.configure_request_security(req, security)
|
||||
@@ -272,56 +335,90 @@ module PlexRubySDK
|
||||
rescue StandardError => e
|
||||
error = e
|
||||
ensure
|
||||
if r.nil? || Utils.error_status?(r.status)
|
||||
r = @sdk_configuration.hooks.after_error(
|
||||
if http_response.nil? || Utils.error_status?(http_response.status)
|
||||
http_response = @sdk_configuration.hooks.after_error(
|
||||
error: error,
|
||||
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
else
|
||||
r = @sdk_configuration.hooks.after_success(
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
end
|
||||
|
||||
if r.nil?
|
||||
if http_response.nil?
|
||||
raise error if !error.nil?
|
||||
raise 'no response'
|
||||
end
|
||||
end
|
||||
|
||||
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
if Utils.match_status_code(http_response.status, ['200'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Operations::GetTokenDetailsUserPlexAccount)
|
||||
response = Models::Operations::GetTokenDetailsResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
user_plex_account: obj
|
||||
)
|
||||
|
||||
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
return response
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['400'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::GetTokenDetailsBadRequest)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['401'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::GetTokenDetailsUnauthorized)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
||||
|
||||
res = ::PlexRubySDK::Operations::GetTokenDetailsResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if r.status == 200
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetTokenDetailsUserPlexAccount)
|
||||
res.user_plex_account = out
|
||||
end
|
||||
elsif r.status == 400
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetTokenDetailsBadRequest)
|
||||
res.bad_request = out
|
||||
end
|
||||
elsif r.status == 401
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetTokenDetailsUnauthorized)
|
||||
res.unauthorized = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::PostUsersSignInDataRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::PostUsersSignInDataResponse) }
|
||||
sig { params(request: T.nilable(Models::Operations::PostUsersSignInDataRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::PostUsersSignInDataResponse) }
|
||||
def post_users_sign_in_data(request, server_url = nil, timeout_ms = nil)
|
||||
# post_users_sign_in_data - Get User Sign In Data
|
||||
# Sign in user with username and password and return user data with Plex authentication token
|
||||
@@ -356,10 +453,11 @@ module PlexRubySDK
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
http_response = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
|
||||
begin
|
||||
r = connection.post(url) do |req|
|
||||
http_response = connection.post(url) do |req|
|
||||
req.body = body
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
@@ -374,52 +472,86 @@ module PlexRubySDK
|
||||
rescue StandardError => e
|
||||
error = e
|
||||
ensure
|
||||
if r.nil? || Utils.error_status?(r.status)
|
||||
r = @sdk_configuration.hooks.after_error(
|
||||
if http_response.nil? || Utils.error_status?(http_response.status)
|
||||
http_response = @sdk_configuration.hooks.after_error(
|
||||
error: error,
|
||||
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
else
|
||||
r = @sdk_configuration.hooks.after_success(
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
response: http_response
|
||||
)
|
||||
end
|
||||
|
||||
if r.nil?
|
||||
if http_response.nil?
|
||||
raise error if !error.nil?
|
||||
raise 'no response'
|
||||
end
|
||||
end
|
||||
|
||||
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
if Utils.match_status_code(http_response.status, ['201'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Operations::PostUsersSignInDataUserPlexAccount)
|
||||
response = Models::Operations::PostUsersSignInDataResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
user_plex_account: obj
|
||||
)
|
||||
|
||||
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
return response
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['400'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::PostUsersSignInDataBadRequest)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['401'])
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
http_response = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: http_response
|
||||
)
|
||||
obj = Crystalline.unmarshal_json(JSON.parse(http_response.env.response_body), Models::Errors::PostUsersSignInDataUnauthorized)
|
||||
obj.raw_response = http_response
|
||||
throw obj
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
||||
end
|
||||
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
||||
else
|
||||
raise ::PlexRubySDK::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
||||
|
||||
res = ::PlexRubySDK::Operations::PostUsersSignInDataResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if r.status == 201
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::PostUsersSignInDataUserPlexAccount)
|
||||
res.user_plex_account = out
|
||||
end
|
||||
elsif r.status == 400
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::PostUsersSignInDataBadRequest)
|
||||
res.bad_request = out
|
||||
end
|
||||
elsif r.status == 401
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::PostUsersSignInDataUnauthorized)
|
||||
res.unauthorized = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user