mirror of
https://github.com/LukeHagar/plexruby.git
synced 2025-12-07 04:20:54 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.526.6
This commit is contained in:
@@ -5,7 +5,10 @@
|
||||
|
||||
require 'faraday'
|
||||
require 'faraday/multipart'
|
||||
require 'faraday/retry'
|
||||
require 'sorbet-runtime'
|
||||
require_relative 'sdk_hooks/hooks'
|
||||
require_relative 'utils/retries'
|
||||
|
||||
module PlexRubySDK
|
||||
extend T::Sig
|
||||
@@ -20,8 +23,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(level: ::PlexRubySDK::Operations::Level, message: ::String, source: ::String).returns(::PlexRubySDK::Operations::LogLineResponse) }
|
||||
def log_line(level, message, source)
|
||||
sig { params(level: ::PlexRubySDK::Operations::Level, message: ::String, source: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::LogLineResponse) }
|
||||
def log_line(level, message, source, timeout_ms = nil)
|
||||
# log_line - Logging a single line message.
|
||||
# This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
|
||||
#
|
||||
@@ -39,11 +42,61 @@ module PlexRubySDK
|
||||
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
|
||||
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
||||
Utils.configure_request_security(req, security) if !security.nil?
|
||||
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
||||
|
||||
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
||||
timeout ||= @sdk_configuration.timeout
|
||||
|
||||
connection = @sdk_configuration.client
|
||||
|
||||
hook_ctx = SDKHooks::HookContext.new(
|
||||
base_url: base_url,
|
||||
oauth2_scopes: nil,
|
||||
operation_id: 'logLine',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.get(url) do |req|
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
req.params = query_params
|
||||
Utils.configure_request_security(req, security)
|
||||
|
||||
@sdk_configuration.hooks.before_request(
|
||||
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
request: req
|
||||
)
|
||||
end
|
||||
rescue StandardError => e
|
||||
error = e
|
||||
ensure
|
||||
if r.nil? || Utils.error_status?(r.status)
|
||||
r = @sdk_configuration.hooks.after_error(
|
||||
error: error,
|
||||
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
)
|
||||
else
|
||||
r = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
)
|
||||
end
|
||||
|
||||
if r.nil?
|
||||
raise error if !error.nil?
|
||||
raise 'no response'
|
||||
end
|
||||
end
|
||||
|
||||
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
@@ -68,8 +121,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: ::String).returns(::PlexRubySDK::Operations::LogMultiLineResponse) }
|
||||
def log_multi_line(request)
|
||||
sig { params(request: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::LogMultiLineResponse) }
|
||||
def log_multi_line(request, timeout_ms = nil)
|
||||
# log_multi_line - Logging a multi-line message
|
||||
# This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
|
||||
# It accepts a text/plain request body, where each line represents a distinct log entry.
|
||||
@@ -100,19 +153,71 @@ module PlexRubySDK
|
||||
req_content_type, data, form = Utils.serialize_request_body(request, :request, :string)
|
||||
headers['content-type'] = req_content_type
|
||||
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
||||
|
||||
if form
|
||||
body = Utils.encode_form(form)
|
||||
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
||||
body = URI.encode_www_form(data)
|
||||
else
|
||||
body = data
|
||||
end
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.post(url) do |req|
|
||||
req.headers = headers
|
||||
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
||||
Utils.configure_request_security(req, security) if !security.nil?
|
||||
if form
|
||||
req.body = Utils.encode_form(form)
|
||||
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
||||
req.body = URI.encode_www_form(data)
|
||||
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
||||
|
||||
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
||||
timeout ||= @sdk_configuration.timeout
|
||||
|
||||
connection = @sdk_configuration.client
|
||||
|
||||
hook_ctx = SDKHooks::HookContext.new(
|
||||
base_url: base_url,
|
||||
oauth2_scopes: nil,
|
||||
operation_id: 'logMultiLine',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.post(url) do |req|
|
||||
req.body = body
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
Utils.configure_request_security(req, security)
|
||||
|
||||
@sdk_configuration.hooks.before_request(
|
||||
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
request: req
|
||||
)
|
||||
end
|
||||
rescue StandardError => e
|
||||
error = e
|
||||
ensure
|
||||
if r.nil? || Utils.error_status?(r.status)
|
||||
r = @sdk_configuration.hooks.after_error(
|
||||
error: error,
|
||||
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
)
|
||||
else
|
||||
req.body = data
|
||||
r = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
)
|
||||
end
|
||||
|
||||
if r.nil?
|
||||
raise error if !error.nil?
|
||||
raise 'no response'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -138,8 +243,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::EnablePaperTrailResponse) }
|
||||
def enable_paper_trail
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::EnablePaperTrailResponse) }
|
||||
def enable_paper_trail(timeout_ms = nil)
|
||||
# enable_paper_trail - Enabling Papertrail
|
||||
# This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
|
||||
#
|
||||
@@ -150,10 +255,60 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.get(url) do |req|
|
||||
req.headers = headers
|
||||
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
||||
Utils.configure_request_security(req, security) if !security.nil?
|
||||
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
||||
|
||||
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
||||
timeout ||= @sdk_configuration.timeout
|
||||
|
||||
connection = @sdk_configuration.client
|
||||
|
||||
hook_ctx = SDKHooks::HookContext.new(
|
||||
base_url: base_url,
|
||||
oauth2_scopes: nil,
|
||||
operation_id: 'enablePaperTrail',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.get(url) do |req|
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
Utils.configure_request_security(req, security)
|
||||
|
||||
@sdk_configuration.hooks.before_request(
|
||||
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
request: req
|
||||
)
|
||||
end
|
||||
rescue StandardError => e
|
||||
error = e
|
||||
ensure
|
||||
if r.nil? || Utils.error_status?(r.status)
|
||||
r = @sdk_configuration.hooks.after_error(
|
||||
error: error,
|
||||
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
)
|
||||
else
|
||||
r = @sdk_configuration.hooks.after_success(
|
||||
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
||||
hook_ctx: hook_ctx
|
||||
),
|
||||
response: r
|
||||
)
|
||||
end
|
||||
|
||||
if r.nil?
|
||||
raise error if !error.nil?
|
||||
raise 'no response'
|
||||
end
|
||||
end
|
||||
|
||||
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
||||
|
||||
Reference in New Issue
Block a user