mirror of
https://github.com/LukeHagar/plexruby.git
synced 2025-12-09 20:57:43 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.308.1
This commit is contained in:
73
lib/open_api_sdk/watchlist.rb
Normal file
73
lib/open_api_sdk/watchlist.rb
Normal file
@@ -0,0 +1,73 @@
|
||||
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'faraday'
|
||||
require 'faraday/multipart'
|
||||
require 'sorbet-runtime'
|
||||
|
||||
module OpenApiSDK
|
||||
extend T::Sig
|
||||
class Watchlist
|
||||
extend T::Sig
|
||||
|
||||
# GET_WATCHLIST_SERVERS contains the list of server urls available to the SDK.
|
||||
GET_WATCHLIST_SERVERS = [
|
||||
'https://metadata.provider.plex.tv', # The plex metadata provider server
|
||||
].freeze
|
||||
# API Calls that perform operations with Plex Media Server Watchlists
|
||||
#
|
||||
|
||||
sig { params(sdk_config: SDKConfiguration).void }
|
||||
def initialize(sdk_config)
|
||||
@sdk_configuration = sdk_config
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::OpenApiSDK::Operations::GetWatchlistRequest), server_url: T.nilable(String)).returns(::OpenApiSDK::Operations::GetWatchlistResponse) }
|
||||
def get_watchlist(request, server_url = nil)
|
||||
# get_watchlist - Get User Watchlist
|
||||
# Get User Watchlist
|
||||
base_url = Utils.template_url(GET_WATCHLIST_SERVERS[0], {
|
||||
})
|
||||
base_url = server_url if !server_url.nil?
|
||||
url = Utils.generate_url(
|
||||
::OpenApiSDK::Operations::GetWatchlistRequest,
|
||||
base_url,
|
||||
'/library/sections/watchlist/{filter}',
|
||||
request,
|
||||
@sdk_configuration.globals
|
||||
)
|
||||
headers = {}
|
||||
query_params = Utils.get_query_params(::OpenApiSDK::Operations::GetWatchlistRequest, request, @sdk_configuration.globals)
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.get(url) do |req|
|
||||
req.headers = headers
|
||||
req.params = query_params
|
||||
Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil?
|
||||
end
|
||||
|
||||
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
|
||||
res = ::OpenApiSDK::Operations::GetWatchlistResponse.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 = Utils.unmarshal_complex(r.env.response_body, ::OpenApiSDK::Operations::GetWatchlistResponseBody)
|
||||
res.two_hundred_application_json_object = out
|
||||
end
|
||||
elsif r.status == 400
|
||||
elsif r.status == 401
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Utils.unmarshal_complex(r.env.response_body, ::OpenApiSDK::Operations::GetWatchlistWatchlistResponseBody)
|
||||
res.four_hundred_and_one_application_json_object = out
|
||||
end
|
||||
end
|
||||
res
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user