mirror of
https://github.com/LukeHagar/plexruby.git
synced 2025-12-06 04:20:52 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.526.6
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
plugins:
|
||||
- rubocop-minitest
|
||||
|
||||
AllCops:
|
||||
Exclude:
|
||||
- Rakefile
|
||||
|
||||
@@ -3,17 +3,17 @@ id: aa9449e7-c19d-411d-b8e2-f9c5fe982f6f
|
||||
management:
|
||||
docChecksum: 68de03e6e877c4fc50ebfdd47bb117ac
|
||||
docVersion: 0.0.3
|
||||
speakeasyVersion: 1.513.4
|
||||
generationVersion: 2.545.4
|
||||
releaseVersion: 0.7.7
|
||||
configChecksum: 8d77b95580838252b22ddb9bb7d067a0
|
||||
speakeasyVersion: 1.526.6
|
||||
generationVersion: 2.563.1
|
||||
releaseVersion: 0.8.0
|
||||
configChecksum: 178358599fd9be85132833f6e1c7adc7
|
||||
repoURL: https://github.com/LukeHagar/plexruby.git
|
||||
repoSubDirectory: .
|
||||
installationURL: https://github.com/LukeHagar/plexruby
|
||||
published: true
|
||||
features:
|
||||
ruby:
|
||||
core: 3.5.4
|
||||
core: 3.6.0
|
||||
deprecations: 2.81.2
|
||||
enums: 2.81.1
|
||||
flattening: 2.81.1
|
||||
@@ -1821,6 +1821,8 @@ generatedFiles:
|
||||
- lib/plex_ruby_sdk/playlists.rb
|
||||
- lib/plex_ruby_sdk/plex.rb
|
||||
- lib/plex_ruby_sdk/plex_api.rb
|
||||
- lib/plex_ruby_sdk/sdk_hooks/hooks.rb
|
||||
- lib/plex_ruby_sdk/sdk_hooks/types.rb
|
||||
- lib/plex_ruby_sdk/sdkconfiguration.rb
|
||||
- lib/plex_ruby_sdk/search.rb
|
||||
- lib/plex_ruby_sdk/server.rb
|
||||
@@ -1830,6 +1832,7 @@ generatedFiles:
|
||||
- lib/plex_ruby_sdk/statistics.rb
|
||||
- lib/plex_ruby_sdk/updater.rb
|
||||
- lib/plex_ruby_sdk/users.rb
|
||||
- lib/plex_ruby_sdk/utils/retries.rb
|
||||
- lib/plex_ruby_sdk/utils/utils.rb
|
||||
- lib/plex_ruby_sdk/video.rb
|
||||
- lib/plex_ruby_sdk/watchlist.rb
|
||||
@@ -1844,6 +1847,7 @@ generatedFiles:
|
||||
- sorbet/rbi/gems/erubi@1.12.0.rbi
|
||||
- sorbet/rbi/gems/faraday-multipart@1.0.4.rbi
|
||||
- sorbet/rbi/gems/faraday-net_http@3.0.2.rbi
|
||||
- sorbet/rbi/gems/faraday-retry@2.2.1.rbi
|
||||
- sorbet/rbi/gems/faraday@2.7.11.rbi
|
||||
- sorbet/rbi/gems/json@2.6.3.rbi
|
||||
- sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi
|
||||
|
||||
@@ -15,7 +15,10 @@ generation:
|
||||
oAuth2ClientCredentialsEnabled: false
|
||||
oAuth2PasswordEnabled: false
|
||||
ruby:
|
||||
version: 0.7.7
|
||||
version: 0.8.0
|
||||
additionalDependencies:
|
||||
development: {}
|
||||
runtime: {}
|
||||
author: LukeHagar
|
||||
description: Ruby Client SDK Generated by Speakeasy
|
||||
flattenGlobalSecurity: false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
speakeasyVersion: 1.513.4
|
||||
speakeasyVersion: 1.526.6
|
||||
sources:
|
||||
my-source:
|
||||
sourceNamespace: my-source
|
||||
@@ -9,19 +9,19 @@ sources:
|
||||
- main
|
||||
plexapi:
|
||||
sourceNamespace: plexapi
|
||||
sourceRevisionDigest: sha256:2066ba94b55e21d651c79003e3cf402fb77c52a0969fc52310b3383fbed038f4
|
||||
sourceRevisionDigest: sha256:cffb18feaa0523b300655a6f0073caad99133b143f5a420fddbb1e1efe47bcaf
|
||||
sourceBlobDigest: sha256:1737023e29cd9cf36c07ccd8c8c48c47e14f47ce22b4d6ba9ee241afbbd8f351
|
||||
tags:
|
||||
- latest
|
||||
- speakeasy-sdk-regen-1741565240
|
||||
- speakeasy-sdk-regen-1743443509
|
||||
targets:
|
||||
plexruby:
|
||||
source: plexapi
|
||||
sourceNamespace: plexapi
|
||||
sourceRevisionDigest: sha256:2066ba94b55e21d651c79003e3cf402fb77c52a0969fc52310b3383fbed038f4
|
||||
sourceRevisionDigest: sha256:cffb18feaa0523b300655a6f0073caad99133b143f5a420fddbb1e1efe47bcaf
|
||||
sourceBlobDigest: sha256:1737023e29cd9cf36c07ccd8c8c48c47e14f47ce22b4d6ba9ee241afbbd8f351
|
||||
codeSamplesNamespace: code-samples-ruby-plexruby
|
||||
codeSamplesRevisionDigest: sha256:9b35ca5755fbeff5addaa5826eaf72ccdd02eff16f325778789aff2fce0136c3
|
||||
codeSamplesRevisionDigest: sha256:094430f15b6dd5749abddab15c1513dff3482821fe0e7020c39129b9d2d092a6
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
@@ -40,3 +40,5 @@ workflow:
|
||||
output: codeSamples.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/plexapi/plexapi/code-samples-ruby-plexruby
|
||||
labelOverride:
|
||||
fixedValue: PlexRuby
|
||||
|
||||
@@ -12,8 +12,8 @@ targets:
|
||||
rubygems:
|
||||
token: $rubygems_auth_token
|
||||
codeSamples:
|
||||
labelOverride:
|
||||
fixedValue: PlexRuby
|
||||
output: codeSamples.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/plexapi/plexapi/code-samples-ruby-plexruby
|
||||
labelOverride:
|
||||
fixedValue: PlexRuby
|
||||
|
||||
52
Gemfile.lock
52
Gemfile.lock
@@ -1,9 +1,10 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
plex_ruby_sdk (0.7.7)
|
||||
plex_ruby_sdk (0.8.0)
|
||||
faraday
|
||||
faraday-multipart
|
||||
faraday-retry (~> 2.2.1)
|
||||
rack
|
||||
rake
|
||||
sorbet-runtime
|
||||
@@ -13,51 +14,57 @@ GEM
|
||||
specs:
|
||||
ast (2.4.2)
|
||||
erubi (1.13.0)
|
||||
faraday (2.12.1)
|
||||
faraday (2.12.2)
|
||||
faraday-net_http (>= 2.0, < 3.5)
|
||||
json
|
||||
logger
|
||||
faraday-multipart (1.0.4)
|
||||
multipart-post (~> 2)
|
||||
faraday-multipart (1.1.0)
|
||||
multipart-post (~> 2.0)
|
||||
faraday-net_http (3.4.0)
|
||||
net-http (>= 0.5.0)
|
||||
faraday-retry (2.2.1)
|
||||
faraday (~> 2.0)
|
||||
json (2.8.2)
|
||||
language_server-protocol (3.17.0.3)
|
||||
logger (1.6.1)
|
||||
language_server-protocol (3.17.0.4)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.6.6)
|
||||
minitest (5.25.2)
|
||||
minitest-focus (1.4.0)
|
||||
minitest (>= 4, < 6)
|
||||
multipart-post (2.4.1)
|
||||
net-http (0.5.0)
|
||||
net-http (0.6.0)
|
||||
uri
|
||||
netrc (0.11.0)
|
||||
parallel (1.26.3)
|
||||
parser (3.3.6.0)
|
||||
parser (3.3.7.1)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
prism (0.27.0)
|
||||
racc (1.8.1)
|
||||
rack (3.1.8)
|
||||
rack (3.1.11)
|
||||
rainbow (3.1.1)
|
||||
rake (13.2.1)
|
||||
rbi (0.1.12)
|
||||
prism (>= 0.18.0, < 0.28)
|
||||
sorbet-runtime (>= 0.5.9204)
|
||||
regexp_parser (2.9.2)
|
||||
rexml (3.3.9)
|
||||
rubocop (1.60.2)
|
||||
regexp_parser (2.10.0)
|
||||
rubocop (1.73.2)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (>= 3.17.0)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.30.0, < 2.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.36.1)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.38.1)
|
||||
parser (>= 3.3.1.0)
|
||||
rubocop-minitest (0.37.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (>= 1.72.1, < 2.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
ruby-progressbar (1.13.0)
|
||||
sorbet (0.5.11668)
|
||||
sorbet-static (= 0.5.11668)
|
||||
@@ -83,8 +90,10 @@ GEM
|
||||
thor (>= 1.2.0)
|
||||
yard-sorbet
|
||||
thor (1.3.2)
|
||||
unicode-display_width (2.6.0)
|
||||
uri (1.0.2)
|
||||
unicode-display_width (3.1.4)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
unicode-emoji (4.0.4)
|
||||
uri (1.0.3)
|
||||
yard (0.9.37)
|
||||
yard-sorbet (0.8.1)
|
||||
sorbet-runtime (>= 0.5)
|
||||
@@ -100,7 +109,8 @@ DEPENDENCIES
|
||||
minitest
|
||||
minitest-focus
|
||||
plex_ruby_sdk!
|
||||
rubocop (~> 1.60.2)
|
||||
rubocop (~> 1.73.2)
|
||||
rubocop-minitest (~> 0.37.1)
|
||||
sorbet
|
||||
tapioca
|
||||
|
||||
|
||||
12
RELEASES.md
12
RELEASES.md
@@ -746,4 +746,14 @@ Based on:
|
||||
### Generated
|
||||
- [ruby v0.7.7] .
|
||||
### Releases
|
||||
- [Ruby Gems v0.7.7] https://rubygems.org/gems/plex_ruby_sdk/versions/0.7.7 - .
|
||||
- [Ruby Gems v0.7.7] https://rubygems.org/gems/plex_ruby_sdk/versions/0.7.7 - .
|
||||
|
||||
## 2025-03-31 17:51:33
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.526.6 (2.563.1) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [ruby v0.8.0] .
|
||||
### Releases
|
||||
- [Ruby Gems v0.8.0] https://rubygems.org/gems/plex_ruby_sdk/versions/0.8.0 - .
|
||||
166
codeSamples.yaml
166
codeSamples.yaml
@@ -7,7 +7,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getServerCapabilities
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -26,7 +26,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getServerPreferences
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -45,7 +45,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: updatePlayProgress
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -64,7 +64,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: markPlayed
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -83,7 +83,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getTimeline
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -115,7 +115,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: markUnplayed
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -134,7 +134,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getServerActivities
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -153,7 +153,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: cancelServerActivities
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -172,7 +172,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: stopAllTasks
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -191,7 +191,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getButlerTasks
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -210,7 +210,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: startAllTasks
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -229,7 +229,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: stopTask
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -248,7 +248,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: startTask
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -267,7 +267,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getAvailableClients
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -286,7 +286,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getCompanionsData
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -305,7 +305,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getDevices
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -324,7 +324,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getUserFriends
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -343,7 +343,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getGeoData
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -358,7 +358,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getHomeData
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -377,7 +377,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getGlobalHubs
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -396,7 +396,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-recently-added
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -407,7 +407,7 @@ actions:
|
||||
)
|
||||
|
||||
req = ::PlexRubySDK::Operations::GetRecentlyAddedRequest.new(
|
||||
content_directory_id: 470161,
|
||||
content_directory_id: 470_161,
|
||||
section_id: 2,
|
||||
type: ::PlexRubySDK::Operations::Type::TV_SHOW,
|
||||
include_meta: ::PlexRubySDK::Operations::IncludeMeta::ENABLE,
|
||||
@@ -424,7 +424,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: performSearch
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -443,7 +443,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: performVoiceSearch
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -462,7 +462,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getLibraryHubs
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -481,7 +481,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-server-identity
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -496,7 +496,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getTopWatchedContent
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -515,7 +515,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getFileHash
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -534,7 +534,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-media-meta-data
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -570,7 +570,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-banner-image
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -598,7 +598,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getMetadataChildren
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -617,7 +617,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-thumb-image
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -645,7 +645,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-recently-added-library
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -687,7 +687,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-search-all-libraries
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -716,7 +716,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-all-libraries
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -735,7 +735,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-watch-list
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -761,7 +761,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: deleteLibrary
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -780,7 +780,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-library-details
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -799,7 +799,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-actors-library
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -818,7 +818,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-all-media-library
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -849,7 +849,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-countries-library
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -868,7 +868,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-genres-library
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -887,7 +887,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-refresh-library-metadata
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -906,7 +906,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-search-library
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -925,7 +925,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-library-items
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -954,7 +954,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: logLine
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -973,7 +973,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: logMultiLine
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -996,7 +996,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: enablePaperTrail
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1015,7 +1015,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-media-providers
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1034,7 +1034,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getMyPlexAccount
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1053,7 +1053,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getResizedPhoto
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1066,7 +1066,7 @@ actions:
|
||||
req = ::PlexRubySDK::Operations::GetResizedPhotoRequest.new(
|
||||
width: 110.0,
|
||||
height: 165.0,
|
||||
opacity: 643869,
|
||||
opacity: 643_869,
|
||||
blur: 0.0,
|
||||
min_size: ::PlexRubySDK::Operations::MinSize::ONE,
|
||||
upscale: ::PlexRubySDK::Operations::Upscale::ONE,
|
||||
@@ -1082,7 +1082,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getPin
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1105,14 +1105,14 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getTokenByPinId
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
s = ::PlexRubySDK::PlexAPI.new
|
||||
|
||||
req = ::PlexRubySDK::Operations::GetTokenByPinIdRequest.new(
|
||||
pin_id: 408895,
|
||||
pin_id: 408_895,
|
||||
client_id: "3381b62b-9ab7-4e37-827b-203e9809eb58",
|
||||
client_name: "Plex for Roku",
|
||||
device_nickname: "Roku 3",
|
||||
@@ -1129,7 +1129,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getPlaylists
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1148,7 +1148,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: createPlaylist
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1174,7 +1174,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: uploadPlaylist
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1193,7 +1193,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: deletePlaylist
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1212,7 +1212,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getPlaylist
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1231,7 +1231,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: updatePlaylist
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1250,7 +1250,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: clearPlaylistContents
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1269,7 +1269,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getPlaylistContents
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1288,7 +1288,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: addPlaylistContents
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1307,7 +1307,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-server-resources
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1326,7 +1326,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getSearchResults
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1345,7 +1345,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getSourceConnectionInformation
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1364,7 +1364,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getTransientToken
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1383,7 +1383,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getServerList
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1402,7 +1402,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getBandwidthStatistics
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1421,7 +1421,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getStatistics
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1440,7 +1440,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getResourcesStatistics
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1459,7 +1459,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getSessions
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1478,7 +1478,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getSessionHistory
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1497,7 +1497,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getTranscodeSessions
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1516,7 +1516,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: stopTranscodeSession
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1535,7 +1535,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: applyUpdates
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1554,7 +1554,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: checkForUpdates
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1573,7 +1573,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getUpdateStatus
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1592,7 +1592,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: getTokenDetails
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1611,7 +1611,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: get-users
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1642,7 +1642,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: post-users-sign-in-data
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
@@ -1670,7 +1670,7 @@ actions:
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: ruby
|
||||
label: startUniversalTranscode
|
||||
label: PlexRuby
|
||||
source: |-
|
||||
require 'plex_ruby_sdk'
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ s = ::PlexRubySDK::PlexAPI.new(
|
||||
)
|
||||
|
||||
req = ::PlexRubySDK::Operations::GetRecentlyAddedRequest.new(
|
||||
content_directory_id: 470161,
|
||||
content_directory_id: 470_161,
|
||||
section_id: 2,
|
||||
type: ::PlexRubySDK::Operations::Type::TV_SHOW,
|
||||
include_meta: ::PlexRubySDK::Operations::IncludeMeta::ENABLE,
|
||||
|
||||
@@ -237,7 +237,7 @@ require 'plex_ruby_sdk'
|
||||
s = ::PlexRubySDK::PlexAPI.new
|
||||
|
||||
req = ::PlexRubySDK::Operations::GetTokenByPinIdRequest.new(
|
||||
pin_id: 408895,
|
||||
pin_id: 408_895,
|
||||
client_id: "3381b62b-9ab7-4e37-827b-203e9809eb58",
|
||||
client_name: "Plex for Roku",
|
||||
device_nickname: "Roku 3",
|
||||
|
||||
@@ -207,7 +207,7 @@ s = ::PlexRubySDK::PlexAPI.new(
|
||||
req = ::PlexRubySDK::Operations::GetResizedPhotoRequest.new(
|
||||
width: 110.0,
|
||||
height: 165.0,
|
||||
opacity: 643869,
|
||||
opacity: 643_869,
|
||||
blur: 0.0,
|
||||
min_size: ::PlexRubySDK::Operations::MinSize::ONE,
|
||||
upscale: ::PlexRubySDK::Operations::Upscale::ONE,
|
||||
|
||||
@@ -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
|
||||
@@ -26,8 +29,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetServerActivitiesResponse) }
|
||||
def get_server_activities
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetServerActivitiesResponse) }
|
||||
def get_server_activities(timeout_ms = nil)
|
||||
# get_server_activities - Get Server Activities
|
||||
# Get Server Activities
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -37,10 +40,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: 'getServerActivities',
|
||||
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')
|
||||
@@ -69,8 +122,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(activity_uuid: ::String).returns(::PlexRubySDK::Operations::CancelServerActivitiesResponse) }
|
||||
def cancel_server_activities(activity_uuid)
|
||||
sig { params(activity_uuid: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::CancelServerActivitiesResponse) }
|
||||
def cancel_server_activities(activity_uuid, timeout_ms = nil)
|
||||
# cancel_server_activities - Cancel Server Activities
|
||||
# Cancel Server Activities
|
||||
request = ::PlexRubySDK::Operations::CancelServerActivitiesRequest.new(
|
||||
@@ -89,10 +142,60 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.delete(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: 'cancelServerActivities',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.delete(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')
|
||||
|
||||
@@ -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
|
||||
@@ -30,8 +33,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(type: ::PlexRubySDK::Operations::GetTransientTokenQueryParamType, scope: ::PlexRubySDK::Operations::Scope).returns(::PlexRubySDK::Operations::GetTransientTokenResponse) }
|
||||
def get_transient_token(type, scope)
|
||||
sig { params(type: ::PlexRubySDK::Operations::GetTransientTokenQueryParamType, scope: ::PlexRubySDK::Operations::Scope, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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.
|
||||
#
|
||||
@@ -48,11 +51,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: 'getTransientToken',
|
||||
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')
|
||||
@@ -77,8 +130,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(source: ::String).returns(::PlexRubySDK::Operations::GetSourceConnectionInformationResponse) }
|
||||
def get_source_connection_information(source)
|
||||
sig { params(source: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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.
|
||||
@@ -95,11 +148,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: 'getSourceConnectionInformation',
|
||||
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')
|
||||
@@ -124,8 +227,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetTokenDetailsResponse) }
|
||||
def get_token_details(server_url = nil)
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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
|
||||
base_url = Utils.template_url(GET_TOKEN_DETAILS_SERVERS[0], {
|
||||
@@ -136,10 +239,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: 'getTokenDetails',
|
||||
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')
|
||||
@@ -168,8 +321,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::PostUsersSignInDataRequest), server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::PostUsersSignInDataResponse) }
|
||||
def post_users_sign_in_data(request, server_url = nil)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::PostUsersSignInDataRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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
|
||||
base_url = Utils.template_url(POST_USERS_SIGN_IN_DATA_SERVERS[0], {
|
||||
@@ -179,17 +332,68 @@ module PlexRubySDK
|
||||
headers = Utils.get_headers(request)
|
||||
req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :form)
|
||||
headers['content-type'] = req_content_type
|
||||
|
||||
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
|
||||
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)
|
||||
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: 'post-users-sign-in-data',
|
||||
security_source: nil
|
||||
)
|
||||
|
||||
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?
|
||||
|
||||
@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
|
||||
|
||||
|
||||
@@ -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 { returns(::PlexRubySDK::Operations::GetButlerTasksResponse) }
|
||||
def get_butler_tasks
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetButlerTasksResponse) }
|
||||
def get_butler_tasks(timeout_ms = nil)
|
||||
# get_butler_tasks - Get Butler tasks
|
||||
# Returns a list of butler tasks
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -31,10 +34,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: 'getButlerTasks',
|
||||
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')
|
||||
@@ -63,8 +116,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::StartAllTasksResponse) }
|
||||
def start_all_tasks
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::StartAllTasksResponse) }
|
||||
def start_all_tasks(timeout_ms = nil)
|
||||
# start_all_tasks - Start all Butler tasks
|
||||
# This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
|
||||
# 1. Any tasks not scheduled to run on the current day will be skipped.
|
||||
@@ -79,10 +132,60 @@ module PlexRubySDK
|
||||
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?
|
||||
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: 'startAllTasks',
|
||||
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.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')
|
||||
@@ -107,8 +210,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::StopAllTasksResponse) }
|
||||
def stop_all_tasks
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::StopAllTasksResponse) }
|
||||
def stop_all_tasks(timeout_ms = nil)
|
||||
# stop_all_tasks - Stop all Butler tasks
|
||||
# This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
|
||||
#
|
||||
@@ -119,10 +222,60 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.delete(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: 'stopAllTasks',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.delete(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')
|
||||
@@ -147,8 +300,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(task_name: ::PlexRubySDK::Operations::TaskName).returns(::PlexRubySDK::Operations::StartTaskResponse) }
|
||||
def start_task(task_name)
|
||||
sig { params(task_name: ::PlexRubySDK::Operations::TaskName, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::StartTaskResponse) }
|
||||
def start_task(task_name, timeout_ms = nil)
|
||||
# start_task - Start a single Butler task
|
||||
# This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
|
||||
# 1. Any tasks not scheduled to run on the current day will be skipped.
|
||||
@@ -172,10 +325,60 @@ module PlexRubySDK
|
||||
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?
|
||||
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: 'startTask',
|
||||
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.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')
|
||||
@@ -200,8 +403,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(task_name: ::PlexRubySDK::Operations::PathParamTaskName).returns(::PlexRubySDK::Operations::StopTaskResponse) }
|
||||
def stop_task(task_name)
|
||||
sig { params(task_name: ::PlexRubySDK::Operations::PathParamTaskName, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::StopTaskResponse) }
|
||||
def stop_task(task_name, timeout_ms = nil)
|
||||
# stop_task - Stop a single Butler task
|
||||
# This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint.
|
||||
#
|
||||
@@ -221,10 +424,60 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.delete(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: 'stopTask',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.delete(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')
|
||||
|
||||
@@ -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(count: T.nilable(::Float), only_transient: T.nilable(::PlexRubySDK::Operations::OnlyTransient)).returns(::PlexRubySDK::Operations::GetGlobalHubsResponse) }
|
||||
def get_global_hubs(count = nil, only_transient = nil)
|
||||
sig { params(count: T.nilable(::Float), only_transient: T.nilable(::PlexRubySDK::Operations::OnlyTransient), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetGlobalHubsResponse) }
|
||||
def get_global_hubs(count = nil, only_transient = nil, timeout_ms = nil)
|
||||
# get_global_hubs - Get Global Hubs
|
||||
# Get Global Hubs filtered by the parameters provided.
|
||||
request = ::PlexRubySDK::Operations::GetGlobalHubsRequest.new(
|
||||
@@ -37,11 +40,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: 'getGlobalHubs',
|
||||
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')
|
||||
@@ -70,8 +123,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetRecentlyAddedRequest)).returns(::PlexRubySDK::Operations::GetRecentlyAddedResponse) }
|
||||
def get_recently_added(request)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetRecentlyAddedRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetRecentlyAddedResponse) }
|
||||
def get_recently_added(request, timeout_ms = nil)
|
||||
# get_recently_added - Get Recently Added
|
||||
# This endpoint will return the recently added content.
|
||||
#
|
||||
@@ -83,11 +136,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: 'get-recently-added',
|
||||
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')
|
||||
@@ -107,8 +210,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(section_id: ::Float, count: T.nilable(::Float), only_transient: T.nilable(::PlexRubySDK::Operations::QueryParamOnlyTransient)).returns(::PlexRubySDK::Operations::GetLibraryHubsResponse) }
|
||||
def get_library_hubs(section_id, count = nil, only_transient = nil)
|
||||
sig { params(section_id: ::Float, count: T.nilable(::Float), only_transient: T.nilable(::PlexRubySDK::Operations::QueryParamOnlyTransient), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetLibraryHubsResponse) }
|
||||
def get_library_hubs(section_id, count = nil, only_transient = nil, timeout_ms = nil)
|
||||
# get_library_hubs - Get library specific hubs
|
||||
# This endpoint will return a list of library specific hubs
|
||||
#
|
||||
@@ -131,11 +234,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: 'getLibraryHubs',
|
||||
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')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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')
|
||||
|
||||
@@ -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(key: ::Float).returns(::PlexRubySDK::Operations::MarkPlayedResponse) }
|
||||
def mark_played(key)
|
||||
sig { params(key: ::Float, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::MarkPlayedResponse) }
|
||||
def mark_played(key, timeout_ms = nil)
|
||||
# mark_played - Mark Media Played
|
||||
# This will mark the provided media key as Played.
|
||||
request = ::PlexRubySDK::Operations::MarkPlayedRequest.new(
|
||||
@@ -36,11 +39,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: 'markPlayed',
|
||||
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')
|
||||
@@ -65,8 +118,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(key: ::Float).returns(::PlexRubySDK::Operations::MarkUnplayedResponse) }
|
||||
def mark_unplayed(key)
|
||||
sig { params(key: ::Float, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::MarkUnplayedResponse) }
|
||||
def mark_unplayed(key, timeout_ms = nil)
|
||||
# mark_unplayed - Mark Media Unplayed
|
||||
# This will mark the provided media key as Unplayed.
|
||||
request = ::PlexRubySDK::Operations::MarkUnplayedRequest.new(
|
||||
@@ -81,11 +134,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: 'markUnplayed',
|
||||
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')
|
||||
@@ -110,8 +213,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(key: ::String, time: ::Float, state: ::String).returns(::PlexRubySDK::Operations::UpdatePlayProgressResponse) }
|
||||
def update_play_progress(key, time, state)
|
||||
sig { params(key: ::String, time: ::Float, state: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::UpdatePlayProgressResponse) }
|
||||
def update_play_progress(key, time, state, timeout_ms = nil)
|
||||
# update_play_progress - Update Media Play Progress
|
||||
# This API command can be used to update the play progress of a media item.
|
||||
#
|
||||
@@ -129,11 +232,61 @@ module PlexRubySDK
|
||||
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
|
||||
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: 'updatePlayProgress',
|
||||
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.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')
|
||||
@@ -158,8 +311,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetBannerImageRequest)).returns(::PlexRubySDK::Operations::GetBannerImageResponse) }
|
||||
def get_banner_image(request)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetBannerImageRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetBannerImageResponse) }
|
||||
def get_banner_image(request, timeout_ms = nil)
|
||||
# get_banner_image - Get Banner Image
|
||||
# Gets the banner image of the media item
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -175,11 +328,61 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json;q=1, image/jpeg;q=0'
|
||||
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: 'get-banner-image',
|
||||
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')
|
||||
@@ -206,8 +409,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetThumbImageRequest)).returns(::PlexRubySDK::Operations::GetThumbImageResponse) }
|
||||
def get_thumb_image(request)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetThumbImageRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetThumbImageResponse) }
|
||||
def get_thumb_image(request, timeout_ms = nil)
|
||||
# get_thumb_image - Get Thumb Image
|
||||
# Gets the thumbnail image of the media item
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -223,11 +426,61 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json;q=1, image/jpeg;q=0'
|
||||
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: 'get-thumb-image',
|
||||
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')
|
||||
|
||||
@@ -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
|
||||
@@ -23,8 +26,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::CreatePlaylistRequest)).returns(::PlexRubySDK::Operations::CreatePlaylistResponse) }
|
||||
def create_playlist(request)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::CreatePlaylistRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::CreatePlaylistResponse) }
|
||||
def create_playlist(request, timeout_ms = nil)
|
||||
# create_playlist - Create a Playlist
|
||||
# Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass:
|
||||
# - `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`).
|
||||
@@ -38,11 +41,61 @@ module PlexRubySDK
|
||||
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
|
||||
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: 'createPlaylist',
|
||||
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.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')
|
||||
@@ -71,8 +124,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(playlist_type: T.nilable(::PlexRubySDK::Operations::PlaylistType), smart: T.nilable(::PlexRubySDK::Operations::QueryParamSmart)).returns(::PlexRubySDK::Operations::GetPlaylistsResponse) }
|
||||
def get_playlists(playlist_type = nil, smart = nil)
|
||||
sig { params(playlist_type: T.nilable(::PlexRubySDK::Operations::PlaylistType), smart: T.nilable(::PlexRubySDK::Operations::QueryParamSmart), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetPlaylistsResponse) }
|
||||
def get_playlists(playlist_type = nil, smart = nil, timeout_ms = nil)
|
||||
# get_playlists - Get All Playlists
|
||||
# Get All Playlists given the specified filters.
|
||||
request = ::PlexRubySDK::Operations::GetPlaylistsRequest.new(
|
||||
@@ -88,11 +141,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: 'getPlaylists',
|
||||
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')
|
||||
@@ -121,8 +224,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(playlist_id: ::Float).returns(::PlexRubySDK::Operations::GetPlaylistResponse) }
|
||||
def get_playlist(playlist_id)
|
||||
sig { params(playlist_id: ::Float, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetPlaylistResponse) }
|
||||
def get_playlist(playlist_id, timeout_ms = nil)
|
||||
# get_playlist - Retrieve Playlist
|
||||
# Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item:
|
||||
# Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing.
|
||||
@@ -143,10 +246,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: 'getPlaylist',
|
||||
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')
|
||||
@@ -175,8 +328,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(playlist_id: ::Float).returns(::PlexRubySDK::Operations::DeletePlaylistResponse) }
|
||||
def delete_playlist(playlist_id)
|
||||
sig { params(playlist_id: ::Float, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::DeletePlaylistResponse) }
|
||||
def delete_playlist(playlist_id, timeout_ms = nil)
|
||||
# delete_playlist - Deletes a Playlist
|
||||
# This endpoint will delete a playlist
|
||||
#
|
||||
@@ -196,10 +349,60 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.delete(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: 'deletePlaylist',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.delete(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')
|
||||
@@ -224,8 +427,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(playlist_id: ::Float, title: T.nilable(::String), summary: T.nilable(::String)).returns(::PlexRubySDK::Operations::UpdatePlaylistResponse) }
|
||||
def update_playlist(playlist_id, title = nil, summary = nil)
|
||||
sig { params(playlist_id: ::Float, title: T.nilable(::String), summary: T.nilable(::String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::UpdatePlaylistResponse) }
|
||||
def update_playlist(playlist_id, title = nil, summary = nil, timeout_ms = nil)
|
||||
# update_playlist - Update a Playlist
|
||||
# From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
|
||||
#
|
||||
@@ -248,11 +451,61 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.put(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: 'updatePlaylist',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.put(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')
|
||||
@@ -277,8 +530,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(playlist_id: ::Float, type: ::PlexRubySDK::Operations::GetPlaylistContentsQueryParamType).returns(::PlexRubySDK::Operations::GetPlaylistContentsResponse) }
|
||||
def get_playlist_contents(playlist_id, type)
|
||||
sig { params(playlist_id: ::Float, type: ::PlexRubySDK::Operations::GetPlaylistContentsQueryParamType, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetPlaylistContentsResponse) }
|
||||
def get_playlist_contents(playlist_id, type, timeout_ms = nil)
|
||||
# get_playlist_contents - Retrieve Playlist Contents
|
||||
# Gets the contents of a playlist. Should be paged by clients via standard mechanisms.
|
||||
# By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter.
|
||||
@@ -303,11 +556,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: 'getPlaylistContents',
|
||||
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')
|
||||
@@ -336,8 +639,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(playlist_id: ::Float).returns(::PlexRubySDK::Operations::ClearPlaylistContentsResponse) }
|
||||
def clear_playlist_contents(playlist_id)
|
||||
sig { params(playlist_id: ::Float, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::ClearPlaylistContentsResponse) }
|
||||
def clear_playlist_contents(playlist_id, timeout_ms = nil)
|
||||
# clear_playlist_contents - Delete Playlist Contents
|
||||
# Clears a playlist, only works with dumb playlists. Returns the playlist.
|
||||
#
|
||||
@@ -357,10 +660,60 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.delete(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: 'clearPlaylistContents',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.delete(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')
|
||||
@@ -385,8 +738,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(playlist_id: ::Float, uri: ::String, play_queue_id: T.nilable(::Float)).returns(::PlexRubySDK::Operations::AddPlaylistContentsResponse) }
|
||||
def add_playlist_contents(playlist_id, uri, play_queue_id = nil)
|
||||
sig { params(playlist_id: ::Float, uri: ::String, play_queue_id: T.nilable(::Float), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::AddPlaylistContentsResponse) }
|
||||
def add_playlist_contents(playlist_id, uri, play_queue_id = nil, timeout_ms = nil)
|
||||
# add_playlist_contents - Adding to a Playlist
|
||||
# Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist.
|
||||
# With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.
|
||||
@@ -410,11 +763,61 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.put(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: 'addPlaylistContents',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.put(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')
|
||||
@@ -443,8 +846,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(path: ::String, force: ::PlexRubySDK::Operations::QueryParamForce, section_id: ::Integer).returns(::PlexRubySDK::Operations::UploadPlaylistResponse) }
|
||||
def upload_playlist(path, force, section_id)
|
||||
sig { params(path: ::String, force: ::PlexRubySDK::Operations::QueryParamForce, section_id: ::Integer, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::UploadPlaylistResponse) }
|
||||
def upload_playlist(path, force, section_id, timeout_ms = nil)
|
||||
# upload_playlist - Upload Playlist
|
||||
# Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file.
|
||||
#
|
||||
@@ -462,11 +865,61 @@ module PlexRubySDK
|
||||
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
|
||||
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: 'uploadPlaylist',
|
||||
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.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')
|
||||
|
||||
@@ -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
|
||||
@@ -50,8 +53,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetCompanionsDataResponse) }
|
||||
def get_companions_data(server_url = nil)
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetCompanionsDataResponse) }
|
||||
def get_companions_data(server_url = nil, timeout_ms = nil)
|
||||
# get_companions_data - Get Companions Data
|
||||
# Get Companions Data
|
||||
base_url = Utils.template_url(GET_COMPANIONS_DATA_SERVERS[0], {
|
||||
@@ -62,10 +65,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: 'getCompanionsData',
|
||||
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')
|
||||
@@ -94,8 +147,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetUserFriendsResponse) }
|
||||
def get_user_friends(server_url = nil)
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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.
|
||||
base_url = Utils.template_url(GET_USER_FRIENDS_SERVERS[0], {
|
||||
@@ -106,10 +159,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: 'getUserFriends',
|
||||
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')
|
||||
@@ -138,8 +241,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetGeoDataResponse) }
|
||||
def get_geo_data(server_url = nil)
|
||||
sig { params(server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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
|
||||
base_url = Utils.template_url(GET_GEO_DATA_SERVERS[0], {
|
||||
@@ -150,8 +253,57 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.get(url) do |req|
|
||||
req.headers = headers
|
||||
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: 'getGeoData',
|
||||
security_source: nil
|
||||
)
|
||||
|
||||
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?
|
||||
|
||||
@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')
|
||||
@@ -180,8 +332,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetHomeDataResponse) }
|
||||
def get_home_data
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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.
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -191,10 +343,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: 'getHomeData',
|
||||
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')
|
||||
@@ -223,8 +425,8 @@ module PlexRubySDK
|
||||
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)).returns(::PlexRubySDK::Operations::GetServerResourcesResponse) }
|
||||
def get_server_resources(client_id, include_https = nil, include_relay = nil, include_i_pv6 = nil, server_url = nil)
|
||||
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) }
|
||||
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(
|
||||
@@ -243,11 +445,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: 'get-server-resources',
|
||||
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')
|
||||
@@ -276,8 +528,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetPinRequest), server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetPinResponse) }
|
||||
def get_pin(request, server_url = nil)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetPinRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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
|
||||
base_url = Utils.template_url(GET_PIN_SERVERS[0], {
|
||||
@@ -289,9 +541,58 @@ module PlexRubySDK
|
||||
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
|
||||
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: 'getPin',
|
||||
security_source: nil
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.post(url) do |req|
|
||||
req.headers.merge!(headers)
|
||||
req.options.timeout = timeout unless timeout.nil?
|
||||
req.params = query_params
|
||||
|
||||
@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')
|
||||
@@ -315,8 +616,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetTokenByPinIdRequest), server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetTokenByPinIdResponse) }
|
||||
def get_token_by_pin_id(request, server_url = nil)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetTokenByPinIdRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::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
|
||||
base_url = Utils.template_url(GET_TOKEN_BY_PIN_ID_SERVERS[0], {
|
||||
@@ -332,8 +633,57 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.get(url) do |req|
|
||||
req.headers = headers
|
||||
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: 'getTokenByPinId',
|
||||
security_source: nil
|
||||
)
|
||||
|
||||
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?
|
||||
|
||||
@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')
|
||||
|
||||
@@ -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
|
||||
@@ -17,7 +20,9 @@ module PlexRubySDK
|
||||
|
||||
sig do
|
||||
params(
|
||||
client: T.nilable(Faraday::Request),
|
||||
client: T.nilable(Faraday::Connection),
|
||||
retry_config: T.nilable(::PlexRubySDK::Utils::RetryConfig),
|
||||
timeout_ms: T.nilable(Integer),
|
||||
security: T.nilable(::PlexRubySDK::Shared::Security),
|
||||
security_source: T.nilable(T.proc.returns(::PlexRubySDK::Shared::Security)),
|
||||
protocol: T.nilable(::PlexRubySDK::ServerVariables::ServerProtocol),
|
||||
@@ -28,9 +33,11 @@ module PlexRubySDK
|
||||
url_params: T.nilable(T::Hash[Symbol, String])
|
||||
).void
|
||||
end
|
||||
def initialize(client: nil, security: nil, security_source: nil, protocol: nil, ip: nil, port: nil, server_idx: nil, server_url: nil, url_params: nil)
|
||||
def initialize(client: nil, retry_config: nil, timeout_ms: nil, security: nil, security_source: nil, protocol: nil, ip: nil, port: nil, server_idx: nil, server_url: nil, url_params: nil)
|
||||
## Instantiates the SDK configuring it with the provided parameters.
|
||||
# @param [T.nilable(Faraday::Request)] client The faraday HTTP client to use for all operations
|
||||
# @param [T.nilable(Faraday::Connection)] client The faraday HTTP client to use for all operations
|
||||
# @param [T.nilable(::PlexRubySDK::Utils::RetryConfig)] retry_config The retry configuration to use for all operations
|
||||
# @param [T.nilable(Integer)] timeout_ms Request timeout in milliseconds for all operations
|
||||
# @param [T.nilable(::PlexRubySDK::Shared::Security)] security: The security details required for authentication
|
||||
# @param [T.proc.returns(T.nilable(::PlexRubySDK::Shared::Security))] security_source: A function that returns security details required for authentication
|
||||
# @param [T.nilable(::PlexRubySDK::ServerVariables::ServerProtocol)] protocol: Allows setting the protocol variable for url substitution
|
||||
@@ -40,13 +47,16 @@ module PlexRubySDK
|
||||
# @param [T.nilable(::String)] server_url The server URL to use for all operations
|
||||
# @param [T.nilable(::Hash<::Symbol, ::String>)] url_params Parameters to optionally template the server URL with
|
||||
|
||||
if client.nil?
|
||||
client = Faraday.new(request: {
|
||||
params_encoder: Faraday::FlatParamsEncoder
|
||||
}) do |f|
|
||||
f.request :multipart, {}
|
||||
# f.response :logger
|
||||
end
|
||||
connection_options = {
|
||||
request: {
|
||||
params_encoder: Faraday::FlatParamsEncoder
|
||||
}
|
||||
}
|
||||
connection_options[:request][:timeout] = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
||||
|
||||
client ||= Faraday.new(**connection_options) do |f|
|
||||
f.request :multipart, {}
|
||||
# f.response :logger, nil, { headers: true, bodies: true, errors: true }
|
||||
end
|
||||
|
||||
if !server_url.nil?
|
||||
@@ -71,14 +81,23 @@ module PlexRubySDK
|
||||
port: port || '32400',
|
||||
},
|
||||
]
|
||||
hooks = SDKHooks::Hooks.new
|
||||
@sdk_configuration = SDKConfiguration.new(
|
||||
client,
|
||||
hooks,
|
||||
retry_config,
|
||||
timeout_ms,
|
||||
security,
|
||||
security_source,
|
||||
server_url,
|
||||
server_idx,
|
||||
server_params
|
||||
)
|
||||
|
||||
original_server_url = @sdk_configuration.get_server_details.first
|
||||
new_server_url, @sdk_configuration.client = hooks.sdk_init(base_url: original_server_url, client: client)
|
||||
@sdk_configuration.server_url = new_server_url if new_server_url != original_server_url
|
||||
|
||||
init_sdks
|
||||
end
|
||||
|
||||
|
||||
103
lib/plex_ruby_sdk/sdk_hooks/hooks.rb
Normal file
103
lib/plex_ruby_sdk/sdk_hooks/hooks.rb
Normal file
@@ -0,0 +1,103 @@
|
||||
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative './registration'
|
||||
require_relative './types'
|
||||
|
||||
require 'sorbet-runtime'
|
||||
|
||||
module PlexRubySDK
|
||||
module SDKHooks
|
||||
class Hooks
|
||||
extend T::Sig
|
||||
|
||||
sig { void }
|
||||
def initialize
|
||||
@sdk_init_hooks = T.let([], T::Array[AbstractSDKInitHook])
|
||||
@before_request_hooks = T.let([], T::Array[AbstractBeforeRequestHook])
|
||||
@after_success_hooks = T.let([], T::Array[AbstractAfterSuccessHook])
|
||||
@after_error_hooks = T.let([], T::Array[AbstractAfterErrorHook])
|
||||
Registration.init_hooks self
|
||||
end
|
||||
|
||||
sig { params(hook: AbstractSDKInitHook).void }
|
||||
def register_sdk_init_hook(hook)
|
||||
@sdk_init_hooks << hook
|
||||
end
|
||||
|
||||
sig { params(hook: AbstractBeforeRequestHook).void }
|
||||
def register_before_request_hook(hook)
|
||||
@before_request_hooks << hook
|
||||
end
|
||||
|
||||
sig { params(hook: AbstractAfterSuccessHook).void }
|
||||
def register_after_success_hook(hook)
|
||||
@after_success_hooks << hook
|
||||
end
|
||||
|
||||
sig { params(hook: AbstractAfterErrorHook).void }
|
||||
def register_after_error_hook(hook)
|
||||
@after_error_hooks << hook
|
||||
end
|
||||
|
||||
sig do
|
||||
params(
|
||||
base_url: String,
|
||||
client: Faraday::Connection
|
||||
).returns([String, Faraday::Connection])
|
||||
end
|
||||
def sdk_init(base_url:, client:)
|
||||
@sdk_init_hooks.each do |hook|
|
||||
base_url, client = hook.sdk_init(base_url: base_url, client: client)
|
||||
end
|
||||
|
||||
return base_url, client
|
||||
end
|
||||
|
||||
sig do
|
||||
params(
|
||||
hook_ctx: BeforeRequestHookContext,
|
||||
request: Faraday::Request
|
||||
).returns(Faraday::Request)
|
||||
end
|
||||
def before_request(hook_ctx:, request:)
|
||||
@before_request_hooks.each do |hook|
|
||||
request = hook.before_request(hook_ctx: hook_ctx, request: request)
|
||||
end
|
||||
|
||||
request
|
||||
end
|
||||
|
||||
sig do
|
||||
params(
|
||||
hook_ctx: AfterSuccessHookContext,
|
||||
response: Faraday::Response
|
||||
).returns(Faraday::Response)
|
||||
end
|
||||
def after_success(hook_ctx:, response:)
|
||||
@after_success_hooks.each do |hook|
|
||||
response = hook.after_success(hook_ctx: hook_ctx, response: response)
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
|
||||
sig do
|
||||
params(
|
||||
error: T.nilable(StandardError),
|
||||
hook_ctx: AfterErrorHookContext,
|
||||
response: T.nilable(Faraday::Response)
|
||||
).returns(T.nilable(Faraday::Response))
|
||||
end
|
||||
def after_error(error:, hook_ctx:, response:)
|
||||
@after_error_hooks.each do |hook|
|
||||
response = hook.after_error(error: error, hook_ctx: hook_ctx, response: response)
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
35
lib/plex_ruby_sdk/sdk_hooks/registration.rb
Normal file
35
lib/plex_ruby_sdk/sdk_hooks/registration.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file is only ever generated once on the first generation and then is free to be modified.
|
||||
# Any hooks you wish to add should be registered in the init_hooks method.
|
||||
#
|
||||
# Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance.
|
||||
#
|
||||
|
||||
require_relative './types'
|
||||
|
||||
require 'sorbet-runtime'
|
||||
|
||||
module PlexRubySDK
|
||||
module SDKHooks
|
||||
class Registration
|
||||
extend T::Sig
|
||||
|
||||
sig do
|
||||
params(
|
||||
hooks: Hooks
|
||||
).void
|
||||
end
|
||||
def self.init_hooks(hooks)
|
||||
# example_hook = ExampleHook.new
|
||||
|
||||
# hooks.register_sdk_init_hook example_hook
|
||||
# hooks.register_before_request_hook example_hook
|
||||
# hooks.register_after_error_hook example_hook
|
||||
# hooks.register_after_success_hook example_hook
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
152
lib/plex_ruby_sdk/sdk_hooks/types.rb
Normal file
152
lib/plex_ruby_sdk/sdk_hooks/types.rb
Normal file
@@ -0,0 +1,152 @@
|
||||
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'sorbet-runtime'
|
||||
|
||||
module PlexRubySDK
|
||||
module SDKHooks
|
||||
class HookContext
|
||||
extend T::Sig
|
||||
|
||||
sig { returns(String) }
|
||||
attr_accessor :base_url
|
||||
|
||||
sig { returns(T.nilable(T::Array[String])) }
|
||||
attr_accessor :oauth2_scopes
|
||||
|
||||
sig { returns(String) }
|
||||
attr_accessor :operation_id
|
||||
|
||||
sig { returns(T.nilable(T.proc.returns(T.untyped))) }
|
||||
attr_accessor :security_source
|
||||
|
||||
sig do
|
||||
params(
|
||||
base_url: String,
|
||||
oauth2_scopes: T.nilable(T::Array[String]),
|
||||
operation_id: String,
|
||||
security_source: T.nilable(T.proc.returns(T.untyped))
|
||||
).void
|
||||
end
|
||||
def initialize(base_url:, oauth2_scopes:, operation_id:, security_source:)
|
||||
@base_url = T.let(base_url, String)
|
||||
@oauth2_scopes = T.let(oauth2_scopes, T.nilable(T::Array[String]))
|
||||
@operation_id = T.let(operation_id, String)
|
||||
@security_source = T.let(security_source, T.nilable(T.proc.returns(T.untyped)))
|
||||
end
|
||||
end
|
||||
|
||||
class BeforeRequestHookContext < HookContext
|
||||
extend T::Sig
|
||||
|
||||
sig do
|
||||
params(
|
||||
hook_ctx: HookContext
|
||||
).void
|
||||
end
|
||||
def initialize(hook_ctx:)
|
||||
super(
|
||||
base_url: hook_ctx.base_url,
|
||||
operation_id: hook_ctx.operation_id,
|
||||
oauth2_scopes: hook_ctx.oauth2_scopes,
|
||||
security_source: hook_ctx.security_source
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class AfterSuccessHookContext < HookContext
|
||||
extend T::Sig
|
||||
|
||||
sig do
|
||||
params(
|
||||
hook_ctx: HookContext
|
||||
).void
|
||||
end
|
||||
def initialize(hook_ctx:)
|
||||
super(
|
||||
base_url: hook_ctx.base_url,
|
||||
operation_id: hook_ctx.operation_id,
|
||||
oauth2_scopes: hook_ctx.oauth2_scopes,
|
||||
security_source: hook_ctx.security_source
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class AfterErrorHookContext < HookContext
|
||||
extend T::Sig
|
||||
|
||||
sig do
|
||||
params(
|
||||
hook_ctx: HookContext
|
||||
).void
|
||||
end
|
||||
def initialize(hook_ctx:)
|
||||
super(
|
||||
base_url: hook_ctx.base_url,
|
||||
operation_id: hook_ctx.operation_id,
|
||||
oauth2_scopes: hook_ctx.oauth2_scopes,
|
||||
security_source: hook_ctx.security_source
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
module AbstractSDKInitHook
|
||||
extend T::Sig
|
||||
extend T::Helpers
|
||||
abstract!
|
||||
|
||||
sig do
|
||||
abstract.params(
|
||||
base_url: String,
|
||||
client: Faraday::Connection
|
||||
).returns([String, Faraday::Connection])
|
||||
end
|
||||
def sdk_init(base_url:, client:); end
|
||||
end
|
||||
|
||||
module AbstractBeforeRequestHook
|
||||
extend T::Sig
|
||||
extend T::Helpers
|
||||
abstract!
|
||||
|
||||
sig do
|
||||
abstract.params(
|
||||
hook_ctx: BeforeRequestHookContext,
|
||||
request: Faraday::Request
|
||||
).returns(Faraday::Request)
|
||||
end
|
||||
def before_request(hook_ctx:, request:); end
|
||||
end
|
||||
|
||||
module AbstractAfterSuccessHook
|
||||
extend T::Sig
|
||||
extend T::Helpers
|
||||
abstract!
|
||||
|
||||
sig do
|
||||
abstract.params(
|
||||
hook_ctx: AfterSuccessHookContext,
|
||||
response: Faraday::Response
|
||||
).returns(Faraday::Response)
|
||||
end
|
||||
def after_success(hook_ctx:, response:); end
|
||||
end
|
||||
|
||||
module AbstractAfterErrorHook
|
||||
extend T::Sig
|
||||
extend T::Helpers
|
||||
abstract!
|
||||
|
||||
sig do
|
||||
abstract.params(
|
||||
error: T.nilable(StandardError),
|
||||
hook_ctx: AfterErrorHookContext,
|
||||
response: T.nilable(Faraday::Response)
|
||||
).returns(T.nilable(Faraday::Response))
|
||||
end
|
||||
def after_error(error:, hook_ctx:, response:); end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
@@ -19,6 +22,9 @@ module PlexRubySDK
|
||||
extend T::Sig
|
||||
|
||||
field :client, T.nilable(Faraday::Connection)
|
||||
field :hooks, ::PlexRubySDK::SDKHooks::Hooks
|
||||
field :retry_config, T.nilable(::PlexRubySDK::Utils::RetryConfig)
|
||||
field :timeout, T.nilable(Float)
|
||||
field :security_source, T.nilable(T.proc.returns(T.nilable(::PlexRubySDK::Shared::Security)))
|
||||
field :server_url, T.nilable(String)
|
||||
field :server_idx, T.nilable(Integer)
|
||||
@@ -29,12 +35,25 @@ module PlexRubySDK
|
||||
field :gen_version, String
|
||||
field :user_agent, String
|
||||
|
||||
|
||||
|
||||
sig { params(client: T.nilable(Faraday::Connection), security: T.nilable(::PlexRubySDK::Shared::Security), security_source: T.nilable(T.proc.returns(::PlexRubySDK::Shared::Security)), server_url: T.nilable(String), server_idx: T.nilable(Integer), server_params: T::Array[String]).void }
|
||||
def initialize(client, security, security_source, server_url, server_idx, server_params)
|
||||
sig do
|
||||
params(
|
||||
client: T.nilable(Faraday::Connection),
|
||||
hooks: ::PlexRubySDK::SDKHooks::Hooks,
|
||||
retry_config: T.nilable(::PlexRubySDK::Utils::RetryConfig),
|
||||
timeout_ms: T.nilable(Integer),
|
||||
security: T.nilable(::PlexRubySDK::Shared::Security),
|
||||
security_source: T.nilable(T.proc.returns(::PlexRubySDK::Shared::Security)),
|
||||
server_url: T.nilable(String),
|
||||
server_idx: T.nilable(Integer),
|
||||
server_params: T::Array[String]
|
||||
).void
|
||||
end
|
||||
def initialize(client, hooks, retry_config, timeout_ms, security, security_source, server_url, server_idx, server_params)
|
||||
@client = client
|
||||
@hooks = hooks
|
||||
@retry_config = retry_config
|
||||
@server_url = server_url
|
||||
@timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
||||
@server_idx = server_idx.nil? ? 0 : server_idx
|
||||
raise StandardError, "Invalid server index #{server_idx}" if @server_idx.negative? || @server_idx >= SERVERS.length
|
||||
@server_params = server_params
|
||||
@@ -45,9 +64,9 @@ module PlexRubySDK
|
||||
end
|
||||
@language = 'ruby'
|
||||
@openapi_doc_version = '0.0.3'
|
||||
@sdk_version = '0.7.7'
|
||||
@gen_version = '2.545.4'
|
||||
@user_agent = 'speakeasy-sdk/ruby 0.7.7 2.545.4 0.0.3 plex_ruby_sdk'
|
||||
@sdk_version = '0.8.0'
|
||||
@gen_version = '2.563.1'
|
||||
@user_agent = 'speakeasy-sdk/ruby 0.8.0 2.563.1 0.0.3 plex_ruby_sdk'
|
||||
end
|
||||
|
||||
sig { returns([String, T::Hash[Symbol, String]]) }
|
||||
|
||||
@@ -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(query: ::String, section_id: T.nilable(::Float), limit: T.nilable(::Float)).returns(::PlexRubySDK::Operations::PerformSearchResponse) }
|
||||
def perform_search(query, section_id = nil, limit = nil)
|
||||
sig { params(query: ::String, section_id: T.nilable(::Float), limit: T.nilable(::Float), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::PerformSearchResponse) }
|
||||
def perform_search(query, section_id = nil, limit = nil, timeout_ms = nil)
|
||||
# perform_search - Perform a search
|
||||
# This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).
|
||||
#
|
||||
@@ -50,11 +53,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: 'performSearch',
|
||||
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')
|
||||
@@ -79,8 +132,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(query: ::String, section_id: T.nilable(::Float), limit: T.nilable(::Float)).returns(::PlexRubySDK::Operations::PerformVoiceSearchResponse) }
|
||||
def perform_voice_search(query, section_id = nil, limit = nil)
|
||||
sig { params(query: ::String, section_id: T.nilable(::Float), limit: T.nilable(::Float), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::PerformVoiceSearchResponse) }
|
||||
def perform_voice_search(query, section_id = nil, limit = nil, timeout_ms = nil)
|
||||
# perform_voice_search - Perform a voice search
|
||||
# This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint.
|
||||
# It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint.
|
||||
@@ -101,11 +154,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: 'performVoiceSearch',
|
||||
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')
|
||||
@@ -130,8 +233,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(query: ::String).returns(::PlexRubySDK::Operations::GetSearchResultsResponse) }
|
||||
def get_search_results(query)
|
||||
sig { params(query: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetSearchResultsResponse) }
|
||||
def get_search_results(query, timeout_ms = nil)
|
||||
# get_search_results - Get Search Results
|
||||
# This will search the database for the string provided.
|
||||
request = ::PlexRubySDK::Operations::GetSearchResultsRequest.new(
|
||||
@@ -146,11 +249,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: 'getSearchResults',
|
||||
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')
|
||||
|
||||
@@ -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 { returns(::PlexRubySDK::Operations::GetServerCapabilitiesResponse) }
|
||||
def get_server_capabilities
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetServerCapabilitiesResponse) }
|
||||
def get_server_capabilities(timeout_ms = nil)
|
||||
# get_server_capabilities - Get Server Capabilities
|
||||
# Get Server Capabilities
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -31,10 +34,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: 'getServerCapabilities',
|
||||
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')
|
||||
@@ -63,8 +116,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetServerPreferencesResponse) }
|
||||
def get_server_preferences
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetServerPreferencesResponse) }
|
||||
def get_server_preferences(timeout_ms = nil)
|
||||
# get_server_preferences - Get Server Preferences
|
||||
# Get Server Preferences
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -74,10 +127,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: 'getServerPreferences',
|
||||
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')
|
||||
@@ -106,8 +209,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetAvailableClientsResponse) }
|
||||
def get_available_clients
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetAvailableClientsResponse) }
|
||||
def get_available_clients(timeout_ms = nil)
|
||||
# get_available_clients - Get Available Clients
|
||||
# Get Available Clients
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -117,10 +220,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: 'getAvailableClients',
|
||||
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')
|
||||
@@ -149,8 +302,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetDevicesResponse) }
|
||||
def get_devices
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetDevicesResponse) }
|
||||
def get_devices(timeout_ms = nil)
|
||||
# get_devices - Get Devices
|
||||
# Get Devices
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -160,10 +313,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: 'getDevices',
|
||||
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')
|
||||
@@ -192,8 +395,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetServerIdentityResponse) }
|
||||
def get_server_identity
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetServerIdentityResponse) }
|
||||
def get_server_identity(timeout_ms = nil)
|
||||
# get_server_identity - Get Server Identity
|
||||
# This request is useful to determine if the server is online or offline
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -203,8 +406,57 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.get(url) do |req|
|
||||
req.headers = headers
|
||||
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: 'get-server-identity',
|
||||
security_source: nil
|
||||
)
|
||||
|
||||
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?
|
||||
|
||||
@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')
|
||||
@@ -228,8 +480,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetMyPlexAccountResponse) }
|
||||
def get_my_plex_account
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetMyPlexAccountResponse) }
|
||||
def get_my_plex_account(timeout_ms = nil)
|
||||
# get_my_plex_account - Get MyPlex Account
|
||||
# Returns MyPlex Account Information
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -239,10 +491,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: 'getMyPlexAccount',
|
||||
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')
|
||||
@@ -271,8 +573,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetResizedPhotoRequest)).returns(::PlexRubySDK::Operations::GetResizedPhotoResponse) }
|
||||
def get_resized_photo(request)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetResizedPhotoRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetResizedPhotoResponse) }
|
||||
def get_resized_photo(request, timeout_ms = nil)
|
||||
# get_resized_photo - Get a Resized Photo
|
||||
# Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
|
||||
#
|
||||
@@ -284,11 +586,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: 'getResizedPhoto',
|
||||
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')
|
||||
@@ -313,8 +665,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(x_plex_token: ::String).returns(::PlexRubySDK::Operations::GetMediaProvidersResponse) }
|
||||
def get_media_providers(x_plex_token)
|
||||
sig { params(x_plex_token: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetMediaProvidersResponse) }
|
||||
def get_media_providers(x_plex_token, timeout_ms = nil)
|
||||
# get_media_providers - Get Media Providers
|
||||
# Retrieves media providers and their features from the Plex server.
|
||||
request = ::PlexRubySDK::Operations::GetMediaProvidersRequest.new(
|
||||
@@ -328,10 +680,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: 'get-media-providers',
|
||||
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')
|
||||
@@ -360,8 +762,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetServerListResponse) }
|
||||
def get_server_list
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetServerListResponse) }
|
||||
def get_server_list(timeout_ms = nil)
|
||||
# get_server_list - Get Server List
|
||||
# Get Server List
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -371,10 +773,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: 'getServerList',
|
||||
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')
|
||||
|
||||
@@ -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 { returns(::PlexRubySDK::Operations::GetSessionsResponse) }
|
||||
def get_sessions
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetSessionsResponse) }
|
||||
def get_sessions(timeout_ms = nil)
|
||||
# get_sessions - Get Active Sessions
|
||||
# This will retrieve the "Now Playing" Information of the PMS.
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -31,10 +34,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: 'getSessions',
|
||||
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')
|
||||
@@ -63,8 +116,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(sort: T.nilable(::String), account_id: T.nilable(::Integer), filter: T.nilable(::PlexRubySDK::Operations::QueryParamFilter), library_section_id: T.nilable(::Integer)).returns(::PlexRubySDK::Operations::GetSessionHistoryResponse) }
|
||||
def get_session_history(sort = nil, account_id = nil, filter = nil, library_section_id = nil)
|
||||
sig { params(sort: T.nilable(::String), account_id: T.nilable(::Integer), filter: T.nilable(::PlexRubySDK::Operations::QueryParamFilter), library_section_id: T.nilable(::Integer), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetSessionHistoryResponse) }
|
||||
def get_session_history(sort = nil, account_id = nil, filter = nil, library_section_id = nil, timeout_ms = nil)
|
||||
# get_session_history - Get Session History
|
||||
# This will Retrieve a listing of all history views.
|
||||
request = ::PlexRubySDK::Operations::GetSessionHistoryRequest.new(
|
||||
@@ -82,11 +135,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: 'getSessionHistory',
|
||||
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')
|
||||
@@ -115,8 +218,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetTranscodeSessionsResponse) }
|
||||
def get_transcode_sessions
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetTranscodeSessionsResponse) }
|
||||
def get_transcode_sessions(timeout_ms = nil)
|
||||
# get_transcode_sessions - Get Transcode Sessions
|
||||
# Get Transcode Sessions
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -126,10 +229,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: 'getTranscodeSessions',
|
||||
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')
|
||||
@@ -158,8 +311,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(session_key: ::String).returns(::PlexRubySDK::Operations::StopTranscodeSessionResponse) }
|
||||
def stop_transcode_session(session_key)
|
||||
sig { params(session_key: ::String, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::StopTranscodeSessionResponse) }
|
||||
def stop_transcode_session(session_key, timeout_ms = nil)
|
||||
# stop_transcode_session - Stop a Transcode Session
|
||||
# Stop a Transcode Session
|
||||
request = ::PlexRubySDK::Operations::StopTranscodeSessionRequest.new(
|
||||
@@ -178,10 +331,60 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.delete(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: 'stopTranscodeSession',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.delete(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')
|
||||
|
||||
@@ -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(timespan: T.nilable(::Integer)).returns(::PlexRubySDK::Operations::GetStatisticsResponse) }
|
||||
def get_statistics(timespan = nil)
|
||||
sig { params(timespan: T.nilable(::Integer), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetStatisticsResponse) }
|
||||
def get_statistics(timespan = nil, timeout_ms = nil)
|
||||
# get_statistics - Get Media Statistics
|
||||
# This will return the media statistics for the server
|
||||
request = ::PlexRubySDK::Operations::GetStatisticsRequest.new(
|
||||
@@ -36,11 +39,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: 'getStatistics',
|
||||
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')
|
||||
@@ -69,8 +122,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(timespan: T.nilable(::Integer)).returns(::PlexRubySDK::Operations::GetResourcesStatisticsResponse) }
|
||||
def get_resources_statistics(timespan = nil)
|
||||
sig { params(timespan: T.nilable(::Integer), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetResourcesStatisticsResponse) }
|
||||
def get_resources_statistics(timespan = nil, timeout_ms = nil)
|
||||
# get_resources_statistics - Get Resources Statistics
|
||||
# This will return the resources for the server
|
||||
request = ::PlexRubySDK::Operations::GetResourcesStatisticsRequest.new(
|
||||
@@ -85,11 +138,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: 'getResourcesStatistics',
|
||||
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')
|
||||
@@ -118,8 +221,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(timespan: T.nilable(::Integer)).returns(::PlexRubySDK::Operations::GetBandwidthStatisticsResponse) }
|
||||
def get_bandwidth_statistics(timespan = nil)
|
||||
sig { params(timespan: T.nilable(::Integer), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetBandwidthStatisticsResponse) }
|
||||
def get_bandwidth_statistics(timespan = nil, timeout_ms = nil)
|
||||
# get_bandwidth_statistics - Get Bandwidth Statistics
|
||||
# This will return the bandwidth statistics for the server
|
||||
request = ::PlexRubySDK::Operations::GetBandwidthStatisticsRequest.new(
|
||||
@@ -134,11 +237,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: 'getBandwidthStatistics',
|
||||
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')
|
||||
|
||||
@@ -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
|
||||
@@ -21,8 +24,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { returns(::PlexRubySDK::Operations::GetUpdateStatusResponse) }
|
||||
def get_update_status
|
||||
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetUpdateStatusResponse) }
|
||||
def get_update_status(timeout_ms = nil)
|
||||
# get_update_status - Querying status of updates
|
||||
# Querying status of updates
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -32,10 +35,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: 'getUpdateStatus',
|
||||
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')
|
||||
@@ -64,8 +117,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(download: T.nilable(::PlexRubySDK::Operations::Download)).returns(::PlexRubySDK::Operations::CheckForUpdatesResponse) }
|
||||
def check_for_updates(download = nil)
|
||||
sig { params(download: T.nilable(::PlexRubySDK::Operations::Download), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::CheckForUpdatesResponse) }
|
||||
def check_for_updates(download = nil, timeout_ms = nil)
|
||||
# check_for_updates - Checking for updates
|
||||
# Checking for updates
|
||||
request = ::PlexRubySDK::Operations::CheckForUpdatesRequest.new(
|
||||
@@ -80,11 +133,61 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.put(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: 'checkForUpdates',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.put(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')
|
||||
@@ -109,8 +212,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(tonight: T.nilable(::PlexRubySDK::Operations::Tonight), skip: T.nilable(::PlexRubySDK::Operations::Skip)).returns(::PlexRubySDK::Operations::ApplyUpdatesResponse) }
|
||||
def apply_updates(tonight = nil, skip = nil)
|
||||
sig { params(tonight: T.nilable(::PlexRubySDK::Operations::Tonight), skip: T.nilable(::PlexRubySDK::Operations::Skip), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::ApplyUpdatesResponse) }
|
||||
def apply_updates(tonight = nil, skip = nil, timeout_ms = nil)
|
||||
# apply_updates - Apply Updates
|
||||
# Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
|
||||
#
|
||||
@@ -127,11 +230,61 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.put(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: 'applyUpdates',
|
||||
security_source: @sdk_configuration.security_source
|
||||
)
|
||||
|
||||
error = T.let(nil, T.nilable(StandardError))
|
||||
r = T.let(nil, T.nilable(Faraday::Response))
|
||||
|
||||
begin
|
||||
r = connection.put(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')
|
||||
|
||||
@@ -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
|
||||
@@ -24,8 +27,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetUsersRequest), server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetUsersResponse) }
|
||||
def get_users(request, server_url = nil)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetUsersRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetUsersResponse) }
|
||||
def get_users(request, server_url = nil, timeout_ms = nil)
|
||||
# get_users - Get list of all connected users
|
||||
# Get list of all users that are friends and have library access with the provided Plex authentication token
|
||||
base_url = Utils.template_url(GET_USERS_SERVERS[0], {
|
||||
@@ -36,8 +39,57 @@ module PlexRubySDK
|
||||
headers['Accept'] = 'application/json;q=1, application/xml;q=0'
|
||||
headers['user-agent'] = @sdk_configuration.user_agent
|
||||
|
||||
r = @sdk_configuration.client.get(url) do |req|
|
||||
req.headers = headers
|
||||
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: 'get-users',
|
||||
security_source: nil
|
||||
)
|
||||
|
||||
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?
|
||||
|
||||
@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')
|
||||
|
||||
95
lib/plex_ruby_sdk/utils/retries.rb
Normal file
95
lib/plex_ruby_sdk/utils/retries.rb
Normal file
@@ -0,0 +1,95 @@
|
||||
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'faraday/retry'
|
||||
require 'sorbet-runtime'
|
||||
|
||||
module PlexRubySDK
|
||||
module Utils
|
||||
class BackoffStrategy
|
||||
extend T::Sig
|
||||
|
||||
sig { returns(T.nilable(::Float)) }
|
||||
attr_accessor :exponent
|
||||
|
||||
sig { returns(T.nilable(::Integer)) }
|
||||
attr_accessor :initial_interval
|
||||
|
||||
sig { returns(T.nilable(::Integer)) }
|
||||
attr_accessor :max_elapsed_time
|
||||
|
||||
sig { returns(T.nilable(::Integer)) }
|
||||
attr_accessor :max_interval
|
||||
|
||||
sig do
|
||||
params(
|
||||
exponent: T.nilable(::Float),
|
||||
initial_interval: T.nilable(::Integer),
|
||||
max_elapsed_time: T.nilable(::Integer),
|
||||
max_interval: T.nilable(::Integer)
|
||||
).void
|
||||
end
|
||||
def initialize(exponent: nil, initial_interval: nil, max_elapsed_time: nil, max_interval: nil)
|
||||
@exponent = T.let(exponent, T.nilable(::Float))
|
||||
@initial_interval = T.let(initial_interval, T.nilable(::Integer))
|
||||
@max_elapsed_time = T.let(max_elapsed_time, T.nilable(::Integer))
|
||||
@max_interval = T.let(max_interval, T.nilable(::Integer))
|
||||
end
|
||||
end
|
||||
|
||||
class RetryConfig
|
||||
extend T::Sig
|
||||
|
||||
sig { returns(T.nilable(BackoffStrategy)) }
|
||||
attr_accessor :backoff
|
||||
|
||||
sig { returns(T.nilable(T::Boolean)) }
|
||||
attr_accessor :retry_connection_errors
|
||||
|
||||
sig { returns(T.nilable(::String)) }
|
||||
attr_accessor :strategy
|
||||
|
||||
sig do
|
||||
params(
|
||||
backoff: T.nilable(BackoffStrategy),
|
||||
retry_connection_errors: T.nilable(T::Boolean),
|
||||
strategy: T.nilable(::String)
|
||||
).void
|
||||
end
|
||||
def initialize(backoff: nil, retry_connection_errors: nil, strategy: nil)
|
||||
@backoff = T.let(backoff, T.nilable(BackoffStrategy))
|
||||
@retry_connection_errors = T.let(retry_connection_errors, T.nilable(T::Boolean))
|
||||
@strategy = T.let(strategy, T.nilable(::String))
|
||||
end
|
||||
|
||||
sig { params(initial_time: ::Time).returns(::Hash) }
|
||||
def to_faraday_retry_options(initial_time:)
|
||||
retry_options = {
|
||||
# must overwrite default max of 2 retries and it must be positive
|
||||
max: 1_000_000_000,
|
||||
# ensure all HTTP methods are retried, especially via retry_if
|
||||
methods: [],
|
||||
}
|
||||
|
||||
if @retry_connection_errors
|
||||
retry_options[:exceptions] = Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Faraday::ConnectionFailed]
|
||||
end
|
||||
|
||||
if @strategy == 'backoff' && @backoff
|
||||
retry_options[:backoff_factor] = @backoff.exponent unless @backoff.exponent.nil?
|
||||
retry_options[:interval] = (@backoff.initial_interval.to_f / 1000) unless @backoff.initial_interval.nil?
|
||||
retry_options[:max_interval] = @backoff.max_interval unless @backoff.max_interval.nil?
|
||||
|
||||
unless @backoff.max_elapsed_time.nil?
|
||||
stop_time = initial_time + (@backoff.max_elapsed_time.to_f / 1000)
|
||||
retry_options[:retry_if] = ->(_env, _exc) { Time.now < stop_time }
|
||||
end
|
||||
end
|
||||
|
||||
retry_options
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -351,6 +351,15 @@ module PlexRubySDK
|
||||
server_url.delete_suffix('/') + path
|
||||
end
|
||||
|
||||
sig { params(status: Integer).returns(T::Boolean) }
|
||||
def self.error_status?(status)
|
||||
status_major = status / 100
|
||||
return true if status_major == 4
|
||||
return true if status_major == 5
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
sig { params(content_type: String, pattern: String).returns(T::Boolean) }
|
||||
def self.match_content_type(content_type, pattern)
|
||||
return true if content_type == pattern || ['*', '*/*'].include?(pattern)
|
||||
@@ -365,6 +374,7 @@ module PlexRubySDK
|
||||
|
||||
sig { params(req: Faraday::Request, security: Object).void }
|
||||
def self.configure_request_security(req, security)
|
||||
return if security.nil?
|
||||
sec_fields = security.fields
|
||||
sec_fields.each do |sec_field|
|
||||
value = security.send(sec_field.name)
|
||||
|
||||
@@ -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(request: T.nilable(::PlexRubySDK::Operations::GetTimelineRequest)).returns(::PlexRubySDK::Operations::GetTimelineResponse) }
|
||||
def get_timeline(request)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetTimelineRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetTimelineResponse) }
|
||||
def get_timeline(request, timeout_ms = nil)
|
||||
# get_timeline - Get the timeline for a media item
|
||||
# Get the timeline for a media item
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -32,11 +35,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: 'getTimeline',
|
||||
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')
|
||||
@@ -61,8 +114,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::StartUniversalTranscodeRequest)).returns(::PlexRubySDK::Operations::StartUniversalTranscodeResponse) }
|
||||
def start_universal_transcode(request)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::StartUniversalTranscodeRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::StartUniversalTranscodeResponse) }
|
||||
def start_universal_transcode(request, timeout_ms = nil)
|
||||
# start_universal_transcode - Start Universal Transcode
|
||||
# Begin a Universal Transcode Session
|
||||
url, params = @sdk_configuration.get_server_details
|
||||
@@ -73,11 +126,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: 'startUniversalTranscode',
|
||||
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')
|
||||
|
||||
@@ -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
|
||||
@@ -25,8 +28,8 @@ module PlexRubySDK
|
||||
end
|
||||
|
||||
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetWatchListRequest), server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetWatchListResponse) }
|
||||
def get_watch_list(request, server_url = nil)
|
||||
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetWatchListRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetWatchListResponse) }
|
||||
def get_watch_list(request, server_url = nil, timeout_ms = nil)
|
||||
# get_watch_list - Get User Watchlist
|
||||
# Get User Watchlist
|
||||
base_url = Utils.template_url(GET_WATCH_LIST_SERVERS[0], {
|
||||
@@ -43,11 +46,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: 'get-watch-list',
|
||||
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')
|
||||
|
||||
@@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__)
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'plex_ruby_sdk'
|
||||
s.version = '0.7.7'
|
||||
s.version = '0.8.0'
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.licenses = ['Apache-2.0']
|
||||
s.summary = ''
|
||||
@@ -23,14 +23,14 @@ Gem::Specification.new do |s|
|
||||
|
||||
s.add_dependency('faraday')
|
||||
s.add_dependency('faraday-multipart')
|
||||
s.add_dependency('faraday-retry', '~> 2.2.1')
|
||||
s.add_dependency('rack')
|
||||
s.add_dependency('rake')
|
||||
s.add_dependency('sorbet-runtime')
|
||||
|
||||
|
||||
s.add_development_dependency('minitest')
|
||||
s.add_development_dependency('minitest-focus')
|
||||
s.add_development_dependency('rubocop', '~> 1.60.2')
|
||||
s.add_development_dependency('rubocop', '~> 1.73.2')
|
||||
s.add_development_dependency('rubocop-minitest', '~> 0.37.1')
|
||||
s.add_development_dependency('sorbet')
|
||||
s.add_development_dependency('tapioca')
|
||||
end
|
||||
|
||||
207
sorbet/rbi/gems/faraday-retry@2.2.1.rbi
generated
Normal file
207
sorbet/rbi/gems/faraday-retry@2.2.1.rbi
generated
Normal file
@@ -0,0 +1,207 @@
|
||||
# typed: true
|
||||
|
||||
# DO NOT EDIT MANUALLY
|
||||
# This is an autogenerated file for types exported from the `faraday-retry` gem.
|
||||
# Please instead update this file by running `bin/tapioca gem faraday-retry`.
|
||||
|
||||
# Faraday namespace.
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retriable_response.rb#4
|
||||
module Faraday
|
||||
class << self
|
||||
# source://faraday/2.12.2/lib/faraday.rb#55
|
||||
def default_adapter; end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#102
|
||||
def default_adapter=(adapter); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#59
|
||||
def default_adapter_options; end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#59
|
||||
def default_adapter_options=(_arg0); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#120
|
||||
def default_connection; end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#62
|
||||
def default_connection=(_arg0); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#127
|
||||
def default_connection_options; end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#134
|
||||
def default_connection_options=(options); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#67
|
||||
def ignore_env_proxy; end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#67
|
||||
def ignore_env_proxy=(_arg0); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#46
|
||||
def lib_path; end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#46
|
||||
def lib_path=(_arg0); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#96
|
||||
def new(url = T.unsafe(nil), options = T.unsafe(nil), &block); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#107
|
||||
def respond_to_missing?(symbol, include_private = T.unsafe(nil)); end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#42
|
||||
def root_path; end
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#42
|
||||
def root_path=(_arg0); end
|
||||
|
||||
private
|
||||
|
||||
# source://faraday/2.12.2/lib/faraday.rb#143
|
||||
def method_missing(name, *args, &block); end
|
||||
end
|
||||
end
|
||||
|
||||
# Exception used to control the Retry middleware.
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retriable_response.rb#6
|
||||
class Faraday::RetriableResponse < ::Faraday::Error; end
|
||||
|
||||
# Middleware main module.
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#4
|
||||
module Faraday::Retry; end
|
||||
|
||||
# This class provides the main implementation for your middleware.
|
||||
# Your middleware can implement any of the following methods:
|
||||
# * on_request - called when the request is being prepared
|
||||
# * on_complete - called when the response is being processed
|
||||
#
|
||||
# Optionally, you can also override the following methods from Faraday::Middleware
|
||||
# * initialize(app, options = {}) - the initializer method
|
||||
# * call(env) - the main middleware invocation method.
|
||||
# This already calls on_request and on_complete, so you normally don't need to override it.
|
||||
# You may need to in case you need to "wrap" the request or need more control
|
||||
# (see "retry" middleware: https://github.com/lostisland/faraday/blob/main/lib/faraday/request/retry.rb#L142).
|
||||
# IMPORTANT: Remember to call `@app.call(env)` or `super` to not interrupt the middleware chain!
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#17
|
||||
class Faraday::Retry::Middleware < ::Faraday::Middleware
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @option options
|
||||
# @param app [#call]
|
||||
# @param options [Hash]
|
||||
# @return [Middleware] a new instance of Middleware
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#127
|
||||
def initialize(app, options = T.unsafe(nil)); end
|
||||
|
||||
# An exception matcher for the rescue clause can usually be any object
|
||||
# that responds to `===`, but for Ruby 1.8 it has to be a Class or Module.
|
||||
#
|
||||
# @api private
|
||||
# @param exceptions [Array]
|
||||
# @return [Module] an exception matcher
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#185
|
||||
def build_exception_matcher(exceptions); end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#133
|
||||
def calculate_sleep_amount(retries, env); end
|
||||
|
||||
# @param env [Faraday::Env]
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#147
|
||||
def call(env); end
|
||||
|
||||
private
|
||||
|
||||
# RFC for RateLimit Header Fields for HTTP:
|
||||
# https://www.ietf.org/archive/id/draft-ietf-httpapi-ratelimit-headers-05.html#name-fields-definition
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#222
|
||||
def calculate_rate_limit_reset(env); end
|
||||
|
||||
# MDN spec for Retry-After header:
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#229
|
||||
def calculate_retry_after(env); end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#234
|
||||
def calculate_retry_interval(retries); end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#245
|
||||
def parse_retry_header(env, header); end
|
||||
|
||||
# @return [Boolean]
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#206
|
||||
def retry_request?(env, exception); end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#211
|
||||
def rewind_files(body); end
|
||||
end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#18
|
||||
Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#22
|
||||
Faraday::Retry::Middleware::IDEMPOTENT_METHODS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
# Options contains the configurable parameters for the Retry middleware.
|
||||
#
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#25
|
||||
class Faraday::Retry::Middleware::Options < ::Faraday::Options
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#58
|
||||
def backoff_factor; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#62
|
||||
def exceptions; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#46
|
||||
def interval; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#54
|
||||
def interval_randomness; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#42
|
||||
def max; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#50
|
||||
def max_interval; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#66
|
||||
def methods; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#74
|
||||
def retry_block; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#70
|
||||
def retry_if; end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#78
|
||||
def retry_statuses; end
|
||||
|
||||
class << self
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#34
|
||||
def from(value); end
|
||||
end
|
||||
end
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/middleware.rb#32
|
||||
Faraday::Retry::Middleware::Options::DEFAULT_CHECK = T.let(T.unsafe(nil), Proc)
|
||||
|
||||
# source://faraday-retry//lib/faraday/retry/version.rb#5
|
||||
Faraday::Retry::VERSION = T.let(T.unsafe(nil), String)
|
||||
Reference in New Issue
Block a user