mirror of
https://github.com/LukeHagar/plexruby.git
synced 2025-12-07 12:47:45 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.531.4
This commit is contained in:
@@ -53,7 +53,7 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetCompanionsDataResponse) }
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetCompanionsDataResponse) }
|
||||
def get_companions_data(server_url = nil, timeout_ms = nil)
|
||||
# get_companions_data - Get Companions Data
|
||||
# Get Companions Data
|
||||
@@ -80,10 +80,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)
|
||||
@@ -98,56 +99,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), T::Array[Models::Operations::ResponseBody])
|
||||
response = Models::Operations::GetCompanionsDataResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
response_bodies: 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::GetCompanionsDataBadRequest)
|
||||
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::GetCompanionsDataUnauthorized)
|
||||
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::GetCompanionsDataResponse.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), T::Array[::PlexRubySDK::Operations::ResponseBody])
|
||||
res.response_bodies = 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::GetCompanionsDataBadRequest)
|
||||
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::GetCompanionsDataUnauthorized)
|
||||
res.unauthorized = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetUserFriendsResponse) }
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetUserFriendsResponse) }
|
||||
def get_user_friends(server_url = nil, timeout_ms = nil)
|
||||
# get_user_friends - Get list of friends of the user logged in
|
||||
# Get friends of provided auth token.
|
||||
@@ -174,10 +209,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)
|
||||
@@ -192,56 +228,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), T::Array[Models::Operations::Friend])
|
||||
response = Models::Operations::GetUserFriendsResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
friends: 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::GetUserFriendsBadRequest)
|
||||
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::GetUserFriendsUnauthorized)
|
||||
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::GetUserFriendsResponse.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), T::Array[::PlexRubySDK::Operations::Friend])
|
||||
res.friends = 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::GetUserFriendsBadRequest)
|
||||
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::GetUserFriendsUnauthorized)
|
||||
res.unauthorized = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetGeoDataResponse) }
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetGeoDataResponse) }
|
||||
def get_geo_data(server_url = nil, timeout_ms = nil)
|
||||
# get_geo_data - Get Geo Data
|
||||
# Returns the geolocation and locale data of the caller
|
||||
@@ -266,10 +336,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?
|
||||
|
||||
@@ -283,56 +354,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::GetGeoDataGeoData)
|
||||
response = Models::Operations::GetGeoDataResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
geo_data: 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::GetGeoDataBadRequest)
|
||||
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::GetGeoDataUnauthorized)
|
||||
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::GetGeoDataResponse.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::GetGeoDataGeoData)
|
||||
res.geo_data = 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::GetGeoDataBadRequest)
|
||||
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::GetGeoDataUnauthorized)
|
||||
res.unauthorized = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetHomeDataResponse) }
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetHomeDataResponse) }
|
||||
def get_home_data(timeout_ms = nil)
|
||||
# get_home_data - Get Plex Home Data
|
||||
# Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.
|
||||
@@ -358,10 +463,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)
|
||||
@@ -376,60 +482,94 @@ 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::GetHomeDataResponseBody)
|
||||
response = Models::Operations::GetHomeDataResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
object: 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::GetHomeDataBadRequest)
|
||||
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::GetHomeDataUnauthorized)
|
||||
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::GetHomeDataResponse.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::GetHomeDataResponseBody)
|
||||
res.object = 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::GetHomeDataBadRequest)
|
||||
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::GetHomeDataUnauthorized)
|
||||
res.unauthorized = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(client_id: ::String, include_https: T.nilable(::PlexRubySDK::Operations::IncludeHttps), include_relay: T.nilable(::PlexRubySDK::Operations::IncludeRelay), include_i_pv6: T.nilable(::PlexRubySDK::Operations::IncludeIPv6), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetServerResourcesResponse) }
|
||||
sig { params(client_id: ::String, include_https: T.nilable(Models::Operations::IncludeHttps), include_relay: T.nilable(Models::Operations::IncludeRelay), include_i_pv6: T.nilable(Models::Operations::IncludeIPv6), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetServerResourcesResponse) }
|
||||
def get_server_resources(client_id, include_https = nil, include_relay = nil, include_i_pv6 = nil, server_url = nil, timeout_ms = nil)
|
||||
# get_server_resources - Get Server Resources
|
||||
# Get Plex server access tokens and server connections
|
||||
request = ::PlexRubySDK::Operations::GetServerResourcesRequest.new(
|
||||
request = Models::Operations::GetServerResourcesRequest.new(
|
||||
|
||||
client_id: client_id,
|
||||
include_https: include_https,
|
||||
@@ -441,7 +581,7 @@ module PlexRubySDK
|
||||
base_url = server_url if !server_url.nil?
|
||||
url = "#{base_url}/resources"
|
||||
headers = Utils.get_headers(request)
|
||||
query_params = Utils.get_query_params(::PlexRubySDK::Operations::GetServerResourcesRequest, request)
|
||||
query_params = Utils.get_query_params(Models::Operations::GetServerResourcesRequest, request)
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
@@ -460,10 +600,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
|
||||
@@ -479,56 +620,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), T::Array[Models::Operations::PlexDevice])
|
||||
response = Models::Operations::GetServerResourcesResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
plex_devices: 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::GetServerResourcesBadRequest)
|
||||
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::GetServerResourcesUnauthorized)
|
||||
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::GetServerResourcesResponse.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), T::Array[::PlexRubySDK::Operations::PlexDevice])
|
||||
res.plex_devices = 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::GetServerResourcesBadRequest)
|
||||
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::GetServerResourcesUnauthorized)
|
||||
res.unauthorized = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetPinRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetPinResponse) }
|
||||
sig { params(request: T.nilable(Models::Operations::GetPinRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetPinResponse) }
|
||||
def get_pin(request, server_url = nil, timeout_ms = nil)
|
||||
# get_pin - Get a Pin
|
||||
# Retrieve a Pin ID from Plex.tv to use for authentication flows
|
||||
@@ -537,7 +712,7 @@ module PlexRubySDK
|
||||
base_url = server_url if !server_url.nil?
|
||||
url = "#{base_url}/pins"
|
||||
headers = Utils.get_headers(request)
|
||||
query_params = Utils.get_query_params(::PlexRubySDK::Operations::GetPinRequest, request)
|
||||
query_params = Utils.get_query_params(Models::Operations::GetPinRequest, request)
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
@@ -554,10 +729,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.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
req.params = query_params
|
||||
@@ -572,51 +748,76 @@ 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::GetPinResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if r.status == 201
|
||||
|
||||
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')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetPinAuthPinContainer)
|
||||
res.auth_pin_container = 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::Operations::GetPinAuthPinContainer)
|
||||
response = Models::Operations::GetPinResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
auth_pin_container: obj
|
||||
)
|
||||
|
||||
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 r.status == 400
|
||||
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::GetPinBadRequest)
|
||||
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::GetPinBadRequest)
|
||||
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(request: T.nilable(::PlexRubySDK::Operations::GetTokenByPinIdRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetTokenByPinIdResponse) }
|
||||
sig { params(request: T.nilable(Models::Operations::GetTokenByPinIdRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetTokenByPinIdResponse) }
|
||||
def get_token_by_pin_id(request, server_url = nil, timeout_ms = nil)
|
||||
# get_token_by_pin_id - Get Access Token by PinId
|
||||
# Retrieve an Access Token from Plex.tv after the Pin has been authenticated
|
||||
@@ -624,7 +825,7 @@ module PlexRubySDK
|
||||
})
|
||||
base_url = server_url if !server_url.nil?
|
||||
url = Utils.generate_url(
|
||||
::PlexRubySDK::Operations::GetTokenByPinIdRequest,
|
||||
Models::Operations::GetTokenByPinIdRequest,
|
||||
base_url,
|
||||
'/pins/{pinID}',
|
||||
request
|
||||
@@ -646,10 +847,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?
|
||||
|
||||
@@ -663,52 +865,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, ['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::GetTokenByPinIdAuthPinContainer)
|
||||
response = Models::Operations::GetTokenByPinIdResponse.new(
|
||||
status_code: http_response.status,
|
||||
content_type: content_type,
|
||||
raw_response: http_response,
|
||||
auth_pin_container: 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::GetTokenByPinIdBadRequest)
|
||||
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, ['404'])
|
||||
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::GetTokenByPinIdResponseBody)
|
||||
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::GetTokenByPinIdResponse.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::GetTokenByPinIdAuthPinContainer)
|
||||
res.auth_pin_container = 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::GetTokenByPinIdBadRequest)
|
||||
res.bad_request = out
|
||||
end
|
||||
elsif r.status == 404
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetTokenByPinIdResponseBody)
|
||||
res.object = out
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user