mirror of
https://github.com/LukeHagar/plexruby.git
synced 2025-12-09 12:47:44 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.198.1
This commit is contained in:
139
lib/open_api_sdk/media.rb
Normal file
139
lib/open_api_sdk/media.rb
Normal file
@@ -0,0 +1,139 @@
|
||||
# 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 Media
|
||||
extend T::Sig
|
||||
# API Calls interacting with Plex Media Server Media
|
||||
#
|
||||
|
||||
sig { params(sdk_config: SDKConfiguration).void }
|
||||
def initialize(sdk_config)
|
||||
@sdk_configuration = sdk_config
|
||||
end
|
||||
|
||||
|
||||
sig { params(key: ::Float).returns(::OpenApiSDK::Operations::MarkPlayedResponse) }
|
||||
def mark_played(key)
|
||||
# mark_played - Mark Media Played
|
||||
# This will mark the provided media key as Played.
|
||||
request = ::OpenApiSDK::Operations::MarkPlayedRequest.new(
|
||||
|
||||
key: key
|
||||
)
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
base_url = Utils.template_url(url, params)
|
||||
url = "#{base_url}/:/scrobble"
|
||||
headers = {}
|
||||
query_params = Utils.get_query_params(::OpenApiSDK::Operations::MarkPlayedRequest, request)
|
||||
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::MarkPlayedResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if [200, 400].include?(r.status)
|
||||
elsif r.status == 401
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Utils.unmarshal_complex(r.env.response_body, ::OpenApiSDK::Operations::MarkPlayedResponseBody)
|
||||
res.object = out
|
||||
end
|
||||
end
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(key: ::Float).returns(::OpenApiSDK::Operations::MarkUnplayedResponse) }
|
||||
def mark_unplayed(key)
|
||||
# mark_unplayed - Mark Media Unplayed
|
||||
# This will mark the provided media key as Unplayed.
|
||||
request = ::OpenApiSDK::Operations::MarkUnplayedRequest.new(
|
||||
|
||||
key: key
|
||||
)
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
base_url = Utils.template_url(url, params)
|
||||
url = "#{base_url}/:/unscrobble"
|
||||
headers = {}
|
||||
query_params = Utils.get_query_params(::OpenApiSDK::Operations::MarkUnplayedRequest, request)
|
||||
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::MarkUnplayedResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if [200, 400].include?(r.status)
|
||||
elsif r.status == 401
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Utils.unmarshal_complex(r.env.response_body, ::OpenApiSDK::Operations::MarkUnplayedResponseBody)
|
||||
res.object = out
|
||||
end
|
||||
end
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
sig { params(key: ::String, time: ::Float, state: ::String).returns(::OpenApiSDK::Operations::UpdatePlayProgressResponse) }
|
||||
def update_play_progress(key, time, state)
|
||||
# update_play_progress - Update Media Play Progress
|
||||
# This API command can be used to update the play progress of a media item.
|
||||
#
|
||||
request = ::OpenApiSDK::Operations::UpdatePlayProgressRequest.new(
|
||||
|
||||
key: key,
|
||||
time: time,
|
||||
state: state
|
||||
)
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
base_url = Utils.template_url(url, params)
|
||||
url = "#{base_url}/:/progress"
|
||||
headers = {}
|
||||
query_params = Utils.get_query_params(::OpenApiSDK::Operations::UpdatePlayProgressRequest, request)
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.post(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::UpdatePlayProgressResponse.new(
|
||||
status_code: r.status, content_type: content_type, raw_response: r
|
||||
)
|
||||
if [200, 400].include?(r.status)
|
||||
elsif r.status == 401
|
||||
if Utils.match_content_type(content_type, 'application/json')
|
||||
out = Utils.unmarshal_complex(r.env.response_body, ::OpenApiSDK::Operations::UpdatePlayProgressResponseBody)
|
||||
res.object = out
|
||||
end
|
||||
end
|
||||
res
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user