plex_ruby_sdk 0.7.7 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/plex_ruby_sdk/activities.rb +115 -12
- data/lib/plex_ruby_sdk/authentication.rb +233 -29
- data/lib/plex_ruby_sdk/butler.rb +283 -30
- data/lib/plex_ruby_sdk/hubs.rb +174 -21
- data/lib/plex_ruby_sdk/library.rb +1307 -110
- data/lib/plex_ruby_sdk/log.rb +179 -24
- data/lib/plex_ruby_sdk/media.rb +288 -35
- data/lib/plex_ruby_sdk/models/operations/get_media_arts_mediacontainer.rb +36 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_arts_metadata.rb +36 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_arts_request.rb +24 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_arts_response.rb +33 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_arts_responsebody.rb +24 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_posters_mediacontainer.rb +36 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_posters_metadata.rb +36 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_posters_request.rb +24 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_posters_response.rb +33 -0
- data/lib/plex_ruby_sdk/models/operations/get_media_posters_responsebody.rb +24 -0
- data/lib/plex_ruby_sdk/models/operations/post_media_arts_request.rb +30 -0
- data/lib/plex_ruby_sdk/models/operations/post_media_arts_response.rb +30 -0
- data/lib/plex_ruby_sdk/models/operations/post_media_poster_request.rb +30 -0
- data/lib/plex_ruby_sdk/models/operations/post_media_poster_response.rb +30 -0
- data/lib/plex_ruby_sdk/models/operations.rb +14 -0
- data/lib/plex_ruby_sdk/playlists.rb +513 -60
- data/lib/plex_ruby_sdk/plex.rb +388 -38
- data/lib/plex_ruby_sdk/plex_api.rb +29 -10
- data/lib/plex_ruby_sdk/sdk_hooks/hooks.rb +103 -0
- data/lib/plex_ruby_sdk/sdk_hooks/registration.rb +35 -0
- data/lib/plex_ruby_sdk/sdk_hooks/types.rb +152 -0
- data/lib/plex_ruby_sdk/sdkconfiguration.rb +26 -7
- data/lib/plex_ruby_sdk/search.rb +174 -21
- data/lib/plex_ruby_sdk/server.rb +505 -53
- data/lib/plex_ruby_sdk/sessions.rb +228 -25
- data/lib/plex_ruby_sdk/statistics.rb +174 -21
- data/lib/plex_ruby_sdk/updater.rb +173 -20
- data/lib/plex_ruby_sdk/users.rb +56 -4
- data/lib/plex_ruby_sdk/utils/retries.rb +95 -0
- data/lib/plex_ruby_sdk/utils/utils.rb +10 -0
- data/lib/plex_ruby_sdk/video.rb +117 -14
- data/lib/plex_ruby_sdk/watchlist.rb +60 -7
- metadata +50 -4
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
require 'faraday'
|
|
7
7
|
require 'faraday/multipart'
|
|
8
|
+
require 'faraday/retry'
|
|
8
9
|
require 'sorbet-runtime'
|
|
10
|
+
require_relative 'sdk_hooks/hooks'
|
|
11
|
+
require_relative 'utils/retries'
|
|
9
12
|
|
|
10
13
|
module PlexRubySDK
|
|
11
14
|
extend T::Sig
|
|
@@ -20,8 +23,8 @@ module PlexRubySDK
|
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
|
|
23
|
-
sig { params(url: ::String, type: T.nilable(::Float)).returns(::PlexRubySDK::Operations::GetFileHashResponse) }
|
|
24
|
-
def get_file_hash(url, type = nil)
|
|
26
|
+
sig { params(url: ::String, type: T.nilable(::Float), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetFileHashResponse) }
|
|
27
|
+
def get_file_hash(url, type = nil, timeout_ms = nil)
|
|
25
28
|
# get_file_hash - Get Hash Value
|
|
26
29
|
# This resource returns hash values for local files
|
|
27
30
|
request = ::PlexRubySDK::Operations::GetFileHashRequest.new(
|
|
@@ -37,11 +40,61 @@ module PlexRubySDK
|
|
|
37
40
|
headers['Accept'] = 'application/json'
|
|
38
41
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
44
|
+
|
|
45
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
46
|
+
timeout ||= @sdk_configuration.timeout
|
|
47
|
+
|
|
48
|
+
connection = @sdk_configuration.client
|
|
49
|
+
|
|
50
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
51
|
+
base_url: base_url,
|
|
52
|
+
oauth2_scopes: nil,
|
|
53
|
+
operation_id: 'getFileHash',
|
|
54
|
+
security_source: @sdk_configuration.security_source
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
58
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
59
|
+
|
|
60
|
+
begin
|
|
61
|
+
r = connection.get(url) do |req|
|
|
62
|
+
req.headers.merge!(headers)
|
|
63
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
64
|
+
req.params = query_params
|
|
65
|
+
Utils.configure_request_security(req, security)
|
|
66
|
+
|
|
67
|
+
@sdk_configuration.hooks.before_request(
|
|
68
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
69
|
+
hook_ctx: hook_ctx
|
|
70
|
+
),
|
|
71
|
+
request: req
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
rescue StandardError => e
|
|
75
|
+
error = e
|
|
76
|
+
ensure
|
|
77
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
78
|
+
r = @sdk_configuration.hooks.after_error(
|
|
79
|
+
error: error,
|
|
80
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
81
|
+
hook_ctx: hook_ctx
|
|
82
|
+
),
|
|
83
|
+
response: r
|
|
84
|
+
)
|
|
85
|
+
else
|
|
86
|
+
r = @sdk_configuration.hooks.after_success(
|
|
87
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
88
|
+
hook_ctx: hook_ctx
|
|
89
|
+
),
|
|
90
|
+
response: r
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if r.nil?
|
|
95
|
+
raise error if !error.nil?
|
|
96
|
+
raise 'no response'
|
|
97
|
+
end
|
|
45
98
|
end
|
|
46
99
|
|
|
47
100
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -66,8 +119,8 @@ module PlexRubySDK
|
|
|
66
119
|
end
|
|
67
120
|
|
|
68
121
|
|
|
69
|
-
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetRecentlyAddedLibraryRequest)).returns(::PlexRubySDK::Operations::GetRecentlyAddedLibraryResponse) }
|
|
70
|
-
def get_recently_added_library(request)
|
|
122
|
+
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetRecentlyAddedLibraryRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetRecentlyAddedLibraryResponse) }
|
|
123
|
+
def get_recently_added_library(request, timeout_ms = nil)
|
|
71
124
|
# get_recently_added_library - Get Recently Added
|
|
72
125
|
# This endpoint will return the recently added content.
|
|
73
126
|
#
|
|
@@ -79,11 +132,61 @@ module PlexRubySDK
|
|
|
79
132
|
headers['Accept'] = 'application/json'
|
|
80
133
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
81
134
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
135
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
136
|
+
|
|
137
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
138
|
+
timeout ||= @sdk_configuration.timeout
|
|
139
|
+
|
|
140
|
+
connection = @sdk_configuration.client
|
|
141
|
+
|
|
142
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
143
|
+
base_url: base_url,
|
|
144
|
+
oauth2_scopes: nil,
|
|
145
|
+
operation_id: 'get-recently-added-library',
|
|
146
|
+
security_source: @sdk_configuration.security_source
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
150
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
151
|
+
|
|
152
|
+
begin
|
|
153
|
+
r = connection.get(url) do |req|
|
|
154
|
+
req.headers.merge!(headers)
|
|
155
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
156
|
+
req.params = query_params
|
|
157
|
+
Utils.configure_request_security(req, security)
|
|
158
|
+
|
|
159
|
+
@sdk_configuration.hooks.before_request(
|
|
160
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
161
|
+
hook_ctx: hook_ctx
|
|
162
|
+
),
|
|
163
|
+
request: req
|
|
164
|
+
)
|
|
165
|
+
end
|
|
166
|
+
rescue StandardError => e
|
|
167
|
+
error = e
|
|
168
|
+
ensure
|
|
169
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
170
|
+
r = @sdk_configuration.hooks.after_error(
|
|
171
|
+
error: error,
|
|
172
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
173
|
+
hook_ctx: hook_ctx
|
|
174
|
+
),
|
|
175
|
+
response: r
|
|
176
|
+
)
|
|
177
|
+
else
|
|
178
|
+
r = @sdk_configuration.hooks.after_success(
|
|
179
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
180
|
+
hook_ctx: hook_ctx
|
|
181
|
+
),
|
|
182
|
+
response: r
|
|
183
|
+
)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
if r.nil?
|
|
187
|
+
raise error if !error.nil?
|
|
188
|
+
raise 'no response'
|
|
189
|
+
end
|
|
87
190
|
end
|
|
88
191
|
|
|
89
192
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -112,8 +215,8 @@ module PlexRubySDK
|
|
|
112
215
|
end
|
|
113
216
|
|
|
114
217
|
|
|
115
|
-
sig { returns(::PlexRubySDK::Operations::GetAllLibrariesResponse) }
|
|
116
|
-
def get_all_libraries
|
|
218
|
+
sig { params(timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetAllLibrariesResponse) }
|
|
219
|
+
def get_all_libraries(timeout_ms = nil)
|
|
117
220
|
# get_all_libraries - Get All Libraries
|
|
118
221
|
# A library section (commonly referred to as just a library) is a collection of media.
|
|
119
222
|
# Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media.
|
|
@@ -129,10 +232,60 @@ module PlexRubySDK
|
|
|
129
232
|
headers['Accept'] = 'application/json'
|
|
130
233
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
131
234
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
235
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
236
|
+
|
|
237
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
238
|
+
timeout ||= @sdk_configuration.timeout
|
|
239
|
+
|
|
240
|
+
connection = @sdk_configuration.client
|
|
241
|
+
|
|
242
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
243
|
+
base_url: base_url,
|
|
244
|
+
oauth2_scopes: nil,
|
|
245
|
+
operation_id: 'get-all-libraries',
|
|
246
|
+
security_source: @sdk_configuration.security_source
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
250
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
251
|
+
|
|
252
|
+
begin
|
|
253
|
+
r = connection.get(url) do |req|
|
|
254
|
+
req.headers.merge!(headers)
|
|
255
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
256
|
+
Utils.configure_request_security(req, security)
|
|
257
|
+
|
|
258
|
+
@sdk_configuration.hooks.before_request(
|
|
259
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
260
|
+
hook_ctx: hook_ctx
|
|
261
|
+
),
|
|
262
|
+
request: req
|
|
263
|
+
)
|
|
264
|
+
end
|
|
265
|
+
rescue StandardError => e
|
|
266
|
+
error = e
|
|
267
|
+
ensure
|
|
268
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
269
|
+
r = @sdk_configuration.hooks.after_error(
|
|
270
|
+
error: error,
|
|
271
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
272
|
+
hook_ctx: hook_ctx
|
|
273
|
+
),
|
|
274
|
+
response: r
|
|
275
|
+
)
|
|
276
|
+
else
|
|
277
|
+
r = @sdk_configuration.hooks.after_success(
|
|
278
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
279
|
+
hook_ctx: hook_ctx
|
|
280
|
+
),
|
|
281
|
+
response: r
|
|
282
|
+
)
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
if r.nil?
|
|
286
|
+
raise error if !error.nil?
|
|
287
|
+
raise 'no response'
|
|
288
|
+
end
|
|
136
289
|
end
|
|
137
290
|
|
|
138
291
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -161,8 +314,8 @@ module PlexRubySDK
|
|
|
161
314
|
end
|
|
162
315
|
|
|
163
316
|
|
|
164
|
-
sig { params(section_key: ::Integer, include_details: T.nilable(::PlexRubySDK::Operations::IncludeDetails)).returns(::PlexRubySDK::Operations::GetLibraryDetailsResponse) }
|
|
165
|
-
def get_library_details(section_key, include_details = nil)
|
|
317
|
+
sig { params(section_key: ::Integer, include_details: T.nilable(::PlexRubySDK::Operations::IncludeDetails), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetLibraryDetailsResponse) }
|
|
318
|
+
def get_library_details(section_key, include_details = nil, timeout_ms = nil)
|
|
166
319
|
# get_library_details - Get Library Details
|
|
167
320
|
# ## Library Details Endpoint
|
|
168
321
|
#
|
|
@@ -222,11 +375,61 @@ module PlexRubySDK
|
|
|
222
375
|
headers['Accept'] = 'application/json'
|
|
223
376
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
224
377
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
378
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
379
|
+
|
|
380
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
381
|
+
timeout ||= @sdk_configuration.timeout
|
|
382
|
+
|
|
383
|
+
connection = @sdk_configuration.client
|
|
384
|
+
|
|
385
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
386
|
+
base_url: base_url,
|
|
387
|
+
oauth2_scopes: nil,
|
|
388
|
+
operation_id: 'get-library-details',
|
|
389
|
+
security_source: @sdk_configuration.security_source
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
393
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
394
|
+
|
|
395
|
+
begin
|
|
396
|
+
r = connection.get(url) do |req|
|
|
397
|
+
req.headers.merge!(headers)
|
|
398
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
399
|
+
req.params = query_params
|
|
400
|
+
Utils.configure_request_security(req, security)
|
|
401
|
+
|
|
402
|
+
@sdk_configuration.hooks.before_request(
|
|
403
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
404
|
+
hook_ctx: hook_ctx
|
|
405
|
+
),
|
|
406
|
+
request: req
|
|
407
|
+
)
|
|
408
|
+
end
|
|
409
|
+
rescue StandardError => e
|
|
410
|
+
error = e
|
|
411
|
+
ensure
|
|
412
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
413
|
+
r = @sdk_configuration.hooks.after_error(
|
|
414
|
+
error: error,
|
|
415
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
416
|
+
hook_ctx: hook_ctx
|
|
417
|
+
),
|
|
418
|
+
response: r
|
|
419
|
+
)
|
|
420
|
+
else
|
|
421
|
+
r = @sdk_configuration.hooks.after_success(
|
|
422
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
423
|
+
hook_ctx: hook_ctx
|
|
424
|
+
),
|
|
425
|
+
response: r
|
|
426
|
+
)
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
if r.nil?
|
|
430
|
+
raise error if !error.nil?
|
|
431
|
+
raise 'no response'
|
|
432
|
+
end
|
|
230
433
|
end
|
|
231
434
|
|
|
232
435
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -255,8 +458,8 @@ module PlexRubySDK
|
|
|
255
458
|
end
|
|
256
459
|
|
|
257
460
|
|
|
258
|
-
sig { params(section_key: ::Integer).returns(::PlexRubySDK::Operations::DeleteLibraryResponse) }
|
|
259
|
-
def delete_library(section_key)
|
|
461
|
+
sig { params(section_key: ::Integer, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::DeleteLibraryResponse) }
|
|
462
|
+
def delete_library(section_key, timeout_ms = nil)
|
|
260
463
|
# delete_library - Delete Library Section
|
|
261
464
|
# Delete a library using a specific section id
|
|
262
465
|
request = ::PlexRubySDK::Operations::DeleteLibraryRequest.new(
|
|
@@ -275,10 +478,60 @@ module PlexRubySDK
|
|
|
275
478
|
headers['Accept'] = 'application/json'
|
|
276
479
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
277
480
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
481
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
482
|
+
|
|
483
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
484
|
+
timeout ||= @sdk_configuration.timeout
|
|
485
|
+
|
|
486
|
+
connection = @sdk_configuration.client
|
|
487
|
+
|
|
488
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
489
|
+
base_url: base_url,
|
|
490
|
+
oauth2_scopes: nil,
|
|
491
|
+
operation_id: 'deleteLibrary',
|
|
492
|
+
security_source: @sdk_configuration.security_source
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
496
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
497
|
+
|
|
498
|
+
begin
|
|
499
|
+
r = connection.delete(url) do |req|
|
|
500
|
+
req.headers.merge!(headers)
|
|
501
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
502
|
+
Utils.configure_request_security(req, security)
|
|
503
|
+
|
|
504
|
+
@sdk_configuration.hooks.before_request(
|
|
505
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
506
|
+
hook_ctx: hook_ctx
|
|
507
|
+
),
|
|
508
|
+
request: req
|
|
509
|
+
)
|
|
510
|
+
end
|
|
511
|
+
rescue StandardError => e
|
|
512
|
+
error = e
|
|
513
|
+
ensure
|
|
514
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
515
|
+
r = @sdk_configuration.hooks.after_error(
|
|
516
|
+
error: error,
|
|
517
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
518
|
+
hook_ctx: hook_ctx
|
|
519
|
+
),
|
|
520
|
+
response: r
|
|
521
|
+
)
|
|
522
|
+
else
|
|
523
|
+
r = @sdk_configuration.hooks.after_success(
|
|
524
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
525
|
+
hook_ctx: hook_ctx
|
|
526
|
+
),
|
|
527
|
+
response: r
|
|
528
|
+
)
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
if r.nil?
|
|
532
|
+
raise error if !error.nil?
|
|
533
|
+
raise 'no response'
|
|
534
|
+
end
|
|
282
535
|
end
|
|
283
536
|
|
|
284
537
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -303,8 +556,8 @@ module PlexRubySDK
|
|
|
303
556
|
end
|
|
304
557
|
|
|
305
558
|
|
|
306
|
-
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetLibraryItemsRequest)).returns(::PlexRubySDK::Operations::GetLibraryItemsResponse) }
|
|
307
|
-
def get_library_items(request)
|
|
559
|
+
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetLibraryItemsRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetLibraryItemsResponse) }
|
|
560
|
+
def get_library_items(request, timeout_ms = nil)
|
|
308
561
|
# get_library_items - Get Library Items
|
|
309
562
|
# Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values:
|
|
310
563
|
# - `all`: All items in the section.
|
|
@@ -341,11 +594,61 @@ module PlexRubySDK
|
|
|
341
594
|
headers['Accept'] = 'application/json'
|
|
342
595
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
343
596
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
597
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
598
|
+
|
|
599
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
600
|
+
timeout ||= @sdk_configuration.timeout
|
|
601
|
+
|
|
602
|
+
connection = @sdk_configuration.client
|
|
603
|
+
|
|
604
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
605
|
+
base_url: base_url,
|
|
606
|
+
oauth2_scopes: nil,
|
|
607
|
+
operation_id: 'get-library-items',
|
|
608
|
+
security_source: @sdk_configuration.security_source
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
612
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
613
|
+
|
|
614
|
+
begin
|
|
615
|
+
r = connection.get(url) do |req|
|
|
616
|
+
req.headers.merge!(headers)
|
|
617
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
618
|
+
req.params = query_params
|
|
619
|
+
Utils.configure_request_security(req, security)
|
|
620
|
+
|
|
621
|
+
@sdk_configuration.hooks.before_request(
|
|
622
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
623
|
+
hook_ctx: hook_ctx
|
|
624
|
+
),
|
|
625
|
+
request: req
|
|
626
|
+
)
|
|
627
|
+
end
|
|
628
|
+
rescue StandardError => e
|
|
629
|
+
error = e
|
|
630
|
+
ensure
|
|
631
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
632
|
+
r = @sdk_configuration.hooks.after_error(
|
|
633
|
+
error: error,
|
|
634
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
635
|
+
hook_ctx: hook_ctx
|
|
636
|
+
),
|
|
637
|
+
response: r
|
|
638
|
+
)
|
|
639
|
+
else
|
|
640
|
+
r = @sdk_configuration.hooks.after_success(
|
|
641
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
642
|
+
hook_ctx: hook_ctx
|
|
643
|
+
),
|
|
644
|
+
response: r
|
|
645
|
+
)
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
if r.nil?
|
|
649
|
+
raise error if !error.nil?
|
|
650
|
+
raise 'no response'
|
|
651
|
+
end
|
|
349
652
|
end
|
|
350
653
|
|
|
351
654
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -374,8 +677,8 @@ module PlexRubySDK
|
|
|
374
677
|
end
|
|
375
678
|
|
|
376
679
|
|
|
377
|
-
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetAllMediaLibraryRequest)).returns(::PlexRubySDK::Operations::GetAllMediaLibraryResponse) }
|
|
378
|
-
def get_all_media_library(request)
|
|
680
|
+
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetAllMediaLibraryRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetAllMediaLibraryResponse) }
|
|
681
|
+
def get_all_media_library(request, timeout_ms = nil)
|
|
379
682
|
# get_all_media_library - Get all media of library
|
|
380
683
|
# Retrieves a list of all general media data for this library.
|
|
381
684
|
#
|
|
@@ -392,11 +695,61 @@ module PlexRubySDK
|
|
|
392
695
|
headers['Accept'] = 'application/json'
|
|
393
696
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
394
697
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
698
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
699
|
+
|
|
700
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
701
|
+
timeout ||= @sdk_configuration.timeout
|
|
702
|
+
|
|
703
|
+
connection = @sdk_configuration.client
|
|
704
|
+
|
|
705
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
706
|
+
base_url: base_url,
|
|
707
|
+
oauth2_scopes: nil,
|
|
708
|
+
operation_id: 'get-all-media-library',
|
|
709
|
+
security_source: @sdk_configuration.security_source
|
|
710
|
+
)
|
|
711
|
+
|
|
712
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
713
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
714
|
+
|
|
715
|
+
begin
|
|
716
|
+
r = connection.get(url) do |req|
|
|
717
|
+
req.headers.merge!(headers)
|
|
718
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
719
|
+
req.params = query_params
|
|
720
|
+
Utils.configure_request_security(req, security)
|
|
721
|
+
|
|
722
|
+
@sdk_configuration.hooks.before_request(
|
|
723
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
724
|
+
hook_ctx: hook_ctx
|
|
725
|
+
),
|
|
726
|
+
request: req
|
|
727
|
+
)
|
|
728
|
+
end
|
|
729
|
+
rescue StandardError => e
|
|
730
|
+
error = e
|
|
731
|
+
ensure
|
|
732
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
733
|
+
r = @sdk_configuration.hooks.after_error(
|
|
734
|
+
error: error,
|
|
735
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
736
|
+
hook_ctx: hook_ctx
|
|
737
|
+
),
|
|
738
|
+
response: r
|
|
739
|
+
)
|
|
740
|
+
else
|
|
741
|
+
r = @sdk_configuration.hooks.after_success(
|
|
742
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
743
|
+
hook_ctx: hook_ctx
|
|
744
|
+
),
|
|
745
|
+
response: r
|
|
746
|
+
)
|
|
747
|
+
end
|
|
748
|
+
|
|
749
|
+
if r.nil?
|
|
750
|
+
raise error if !error.nil?
|
|
751
|
+
raise 'no response'
|
|
752
|
+
end
|
|
400
753
|
end
|
|
401
754
|
|
|
402
755
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -426,8 +779,8 @@ module PlexRubySDK
|
|
|
426
779
|
end
|
|
427
780
|
|
|
428
781
|
|
|
429
|
-
sig { params(section_key: ::Integer, force: T.nilable(::PlexRubySDK::Operations::Force)).returns(::PlexRubySDK::Operations::GetRefreshLibraryMetadataResponse) }
|
|
430
|
-
def get_refresh_library_metadata(section_key, force = nil)
|
|
782
|
+
sig { params(section_key: ::Integer, force: T.nilable(::PlexRubySDK::Operations::Force), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetRefreshLibraryMetadataResponse) }
|
|
783
|
+
def get_refresh_library_metadata(section_key, force = nil, timeout_ms = nil)
|
|
431
784
|
# get_refresh_library_metadata - Refresh Metadata Of The Library
|
|
432
785
|
# This endpoint Refreshes all the Metadata of the library.
|
|
433
786
|
#
|
|
@@ -449,11 +802,61 @@ module PlexRubySDK
|
|
|
449
802
|
headers['Accept'] = 'application/json'
|
|
450
803
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
451
804
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
805
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
806
|
+
|
|
807
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
808
|
+
timeout ||= @sdk_configuration.timeout
|
|
809
|
+
|
|
810
|
+
connection = @sdk_configuration.client
|
|
811
|
+
|
|
812
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
813
|
+
base_url: base_url,
|
|
814
|
+
oauth2_scopes: nil,
|
|
815
|
+
operation_id: 'get-refresh-library-metadata',
|
|
816
|
+
security_source: @sdk_configuration.security_source
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
820
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
821
|
+
|
|
822
|
+
begin
|
|
823
|
+
r = connection.get(url) do |req|
|
|
824
|
+
req.headers.merge!(headers)
|
|
825
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
826
|
+
req.params = query_params
|
|
827
|
+
Utils.configure_request_security(req, security)
|
|
828
|
+
|
|
829
|
+
@sdk_configuration.hooks.before_request(
|
|
830
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
831
|
+
hook_ctx: hook_ctx
|
|
832
|
+
),
|
|
833
|
+
request: req
|
|
834
|
+
)
|
|
835
|
+
end
|
|
836
|
+
rescue StandardError => e
|
|
837
|
+
error = e
|
|
838
|
+
ensure
|
|
839
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
840
|
+
r = @sdk_configuration.hooks.after_error(
|
|
841
|
+
error: error,
|
|
842
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
843
|
+
hook_ctx: hook_ctx
|
|
844
|
+
),
|
|
845
|
+
response: r
|
|
846
|
+
)
|
|
847
|
+
else
|
|
848
|
+
r = @sdk_configuration.hooks.after_success(
|
|
849
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
850
|
+
hook_ctx: hook_ctx
|
|
851
|
+
),
|
|
852
|
+
response: r
|
|
853
|
+
)
|
|
854
|
+
end
|
|
855
|
+
|
|
856
|
+
if r.nil?
|
|
857
|
+
raise error if !error.nil?
|
|
858
|
+
raise 'no response'
|
|
859
|
+
end
|
|
457
860
|
end
|
|
458
861
|
|
|
459
862
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -478,8 +881,8 @@ module PlexRubySDK
|
|
|
478
881
|
end
|
|
479
882
|
|
|
480
883
|
|
|
481
|
-
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetSearchLibraryQueryParamType).returns(::PlexRubySDK::Operations::GetSearchLibraryResponse) }
|
|
482
|
-
def get_search_library(section_key, type)
|
|
884
|
+
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetSearchLibraryQueryParamType, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetSearchLibraryResponse) }
|
|
885
|
+
def get_search_library(section_key, type, timeout_ms = nil)
|
|
483
886
|
# get_search_library - Search Library
|
|
484
887
|
# Search for content within a specific section of the library.
|
|
485
888
|
#
|
|
@@ -518,11 +921,61 @@ module PlexRubySDK
|
|
|
518
921
|
headers['Accept'] = 'application/json'
|
|
519
922
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
520
923
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
924
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
925
|
+
|
|
926
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
927
|
+
timeout ||= @sdk_configuration.timeout
|
|
928
|
+
|
|
929
|
+
connection = @sdk_configuration.client
|
|
930
|
+
|
|
931
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
932
|
+
base_url: base_url,
|
|
933
|
+
oauth2_scopes: nil,
|
|
934
|
+
operation_id: 'get-search-library',
|
|
935
|
+
security_source: @sdk_configuration.security_source
|
|
936
|
+
)
|
|
937
|
+
|
|
938
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
939
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
940
|
+
|
|
941
|
+
begin
|
|
942
|
+
r = connection.get(url) do |req|
|
|
943
|
+
req.headers.merge!(headers)
|
|
944
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
945
|
+
req.params = query_params
|
|
946
|
+
Utils.configure_request_security(req, security)
|
|
947
|
+
|
|
948
|
+
@sdk_configuration.hooks.before_request(
|
|
949
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
950
|
+
hook_ctx: hook_ctx
|
|
951
|
+
),
|
|
952
|
+
request: req
|
|
953
|
+
)
|
|
954
|
+
end
|
|
955
|
+
rescue StandardError => e
|
|
956
|
+
error = e
|
|
957
|
+
ensure
|
|
958
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
959
|
+
r = @sdk_configuration.hooks.after_error(
|
|
960
|
+
error: error,
|
|
961
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
962
|
+
hook_ctx: hook_ctx
|
|
963
|
+
),
|
|
964
|
+
response: r
|
|
965
|
+
)
|
|
966
|
+
else
|
|
967
|
+
r = @sdk_configuration.hooks.after_success(
|
|
968
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
969
|
+
hook_ctx: hook_ctx
|
|
970
|
+
),
|
|
971
|
+
response: r
|
|
972
|
+
)
|
|
973
|
+
end
|
|
974
|
+
|
|
975
|
+
if r.nil?
|
|
976
|
+
raise error if !error.nil?
|
|
977
|
+
raise 'no response'
|
|
978
|
+
end
|
|
526
979
|
end
|
|
527
980
|
|
|
528
981
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -551,8 +1004,8 @@ module PlexRubySDK
|
|
|
551
1004
|
end
|
|
552
1005
|
|
|
553
1006
|
|
|
554
|
-
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetGenresLibraryQueryParamType).returns(::PlexRubySDK::Operations::GetGenresLibraryResponse) }
|
|
555
|
-
def get_genres_library(section_key, type)
|
|
1007
|
+
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetGenresLibraryQueryParamType, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetGenresLibraryResponse) }
|
|
1008
|
+
def get_genres_library(section_key, type, timeout_ms = nil)
|
|
556
1009
|
# get_genres_library - Get Genres of library media
|
|
557
1010
|
# Retrieves a list of all the genres that are found for the media in this library.
|
|
558
1011
|
#
|
|
@@ -574,11 +1027,61 @@ module PlexRubySDK
|
|
|
574
1027
|
headers['Accept'] = 'application/json'
|
|
575
1028
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
576
1029
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
1030
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1031
|
+
|
|
1032
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1033
|
+
timeout ||= @sdk_configuration.timeout
|
|
1034
|
+
|
|
1035
|
+
connection = @sdk_configuration.client
|
|
1036
|
+
|
|
1037
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1038
|
+
base_url: base_url,
|
|
1039
|
+
oauth2_scopes: nil,
|
|
1040
|
+
operation_id: 'get-genres-library',
|
|
1041
|
+
security_source: @sdk_configuration.security_source
|
|
1042
|
+
)
|
|
1043
|
+
|
|
1044
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1045
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1046
|
+
|
|
1047
|
+
begin
|
|
1048
|
+
r = connection.get(url) do |req|
|
|
1049
|
+
req.headers.merge!(headers)
|
|
1050
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1051
|
+
req.params = query_params
|
|
1052
|
+
Utils.configure_request_security(req, security)
|
|
1053
|
+
|
|
1054
|
+
@sdk_configuration.hooks.before_request(
|
|
1055
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1056
|
+
hook_ctx: hook_ctx
|
|
1057
|
+
),
|
|
1058
|
+
request: req
|
|
1059
|
+
)
|
|
1060
|
+
end
|
|
1061
|
+
rescue StandardError => e
|
|
1062
|
+
error = e
|
|
1063
|
+
ensure
|
|
1064
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1065
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1066
|
+
error: error,
|
|
1067
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1068
|
+
hook_ctx: hook_ctx
|
|
1069
|
+
),
|
|
1070
|
+
response: r
|
|
1071
|
+
)
|
|
1072
|
+
else
|
|
1073
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1074
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1075
|
+
hook_ctx: hook_ctx
|
|
1076
|
+
),
|
|
1077
|
+
response: r
|
|
1078
|
+
)
|
|
1079
|
+
end
|
|
1080
|
+
|
|
1081
|
+
if r.nil?
|
|
1082
|
+
raise error if !error.nil?
|
|
1083
|
+
raise 'no response'
|
|
1084
|
+
end
|
|
582
1085
|
end
|
|
583
1086
|
|
|
584
1087
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -608,8 +1111,8 @@ module PlexRubySDK
|
|
|
608
1111
|
end
|
|
609
1112
|
|
|
610
1113
|
|
|
611
|
-
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetCountriesLibraryQueryParamType).returns(::PlexRubySDK::Operations::GetCountriesLibraryResponse) }
|
|
612
|
-
def get_countries_library(section_key, type)
|
|
1114
|
+
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetCountriesLibraryQueryParamType, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetCountriesLibraryResponse) }
|
|
1115
|
+
def get_countries_library(section_key, type, timeout_ms = nil)
|
|
613
1116
|
# get_countries_library - Get Countries of library media
|
|
614
1117
|
# Retrieves a list of all the countries that are found for the media in this library.
|
|
615
1118
|
#
|
|
@@ -631,11 +1134,61 @@ module PlexRubySDK
|
|
|
631
1134
|
headers['Accept'] = 'application/json'
|
|
632
1135
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
633
1136
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
1137
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1138
|
+
|
|
1139
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1140
|
+
timeout ||= @sdk_configuration.timeout
|
|
1141
|
+
|
|
1142
|
+
connection = @sdk_configuration.client
|
|
1143
|
+
|
|
1144
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1145
|
+
base_url: base_url,
|
|
1146
|
+
oauth2_scopes: nil,
|
|
1147
|
+
operation_id: 'get-countries-library',
|
|
1148
|
+
security_source: @sdk_configuration.security_source
|
|
1149
|
+
)
|
|
1150
|
+
|
|
1151
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1152
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1153
|
+
|
|
1154
|
+
begin
|
|
1155
|
+
r = connection.get(url) do |req|
|
|
1156
|
+
req.headers.merge!(headers)
|
|
1157
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1158
|
+
req.params = query_params
|
|
1159
|
+
Utils.configure_request_security(req, security)
|
|
1160
|
+
|
|
1161
|
+
@sdk_configuration.hooks.before_request(
|
|
1162
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1163
|
+
hook_ctx: hook_ctx
|
|
1164
|
+
),
|
|
1165
|
+
request: req
|
|
1166
|
+
)
|
|
1167
|
+
end
|
|
1168
|
+
rescue StandardError => e
|
|
1169
|
+
error = e
|
|
1170
|
+
ensure
|
|
1171
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1172
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1173
|
+
error: error,
|
|
1174
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1175
|
+
hook_ctx: hook_ctx
|
|
1176
|
+
),
|
|
1177
|
+
response: r
|
|
1178
|
+
)
|
|
1179
|
+
else
|
|
1180
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1181
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1182
|
+
hook_ctx: hook_ctx
|
|
1183
|
+
),
|
|
1184
|
+
response: r
|
|
1185
|
+
)
|
|
1186
|
+
end
|
|
1187
|
+
|
|
1188
|
+
if r.nil?
|
|
1189
|
+
raise error if !error.nil?
|
|
1190
|
+
raise 'no response'
|
|
1191
|
+
end
|
|
639
1192
|
end
|
|
640
1193
|
|
|
641
1194
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -665,8 +1218,8 @@ module PlexRubySDK
|
|
|
665
1218
|
end
|
|
666
1219
|
|
|
667
1220
|
|
|
668
|
-
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetActorsLibraryQueryParamType).returns(::PlexRubySDK::Operations::GetActorsLibraryResponse) }
|
|
669
|
-
def get_actors_library(section_key, type)
|
|
1221
|
+
sig { params(section_key: ::Integer, type: ::PlexRubySDK::Operations::GetActorsLibraryQueryParamType, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetActorsLibraryResponse) }
|
|
1222
|
+
def get_actors_library(section_key, type, timeout_ms = nil)
|
|
670
1223
|
# get_actors_library - Get Actors of library media
|
|
671
1224
|
# Retrieves a list of all the actors that are found for the media in this library.
|
|
672
1225
|
#
|
|
@@ -688,11 +1241,61 @@ module PlexRubySDK
|
|
|
688
1241
|
headers['Accept'] = 'application/json'
|
|
689
1242
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
690
1243
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
1244
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1245
|
+
|
|
1246
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1247
|
+
timeout ||= @sdk_configuration.timeout
|
|
1248
|
+
|
|
1249
|
+
connection = @sdk_configuration.client
|
|
1250
|
+
|
|
1251
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1252
|
+
base_url: base_url,
|
|
1253
|
+
oauth2_scopes: nil,
|
|
1254
|
+
operation_id: 'get-actors-library',
|
|
1255
|
+
security_source: @sdk_configuration.security_source
|
|
1256
|
+
)
|
|
1257
|
+
|
|
1258
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1259
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1260
|
+
|
|
1261
|
+
begin
|
|
1262
|
+
r = connection.get(url) do |req|
|
|
1263
|
+
req.headers.merge!(headers)
|
|
1264
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1265
|
+
req.params = query_params
|
|
1266
|
+
Utils.configure_request_security(req, security)
|
|
1267
|
+
|
|
1268
|
+
@sdk_configuration.hooks.before_request(
|
|
1269
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1270
|
+
hook_ctx: hook_ctx
|
|
1271
|
+
),
|
|
1272
|
+
request: req
|
|
1273
|
+
)
|
|
1274
|
+
end
|
|
1275
|
+
rescue StandardError => e
|
|
1276
|
+
error = e
|
|
1277
|
+
ensure
|
|
1278
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1279
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1280
|
+
error: error,
|
|
1281
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1282
|
+
hook_ctx: hook_ctx
|
|
1283
|
+
),
|
|
1284
|
+
response: r
|
|
1285
|
+
)
|
|
1286
|
+
else
|
|
1287
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1288
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1289
|
+
hook_ctx: hook_ctx
|
|
1290
|
+
),
|
|
1291
|
+
response: r
|
|
1292
|
+
)
|
|
1293
|
+
end
|
|
1294
|
+
|
|
1295
|
+
if r.nil?
|
|
1296
|
+
raise error if !error.nil?
|
|
1297
|
+
raise 'no response'
|
|
1298
|
+
end
|
|
696
1299
|
end
|
|
697
1300
|
|
|
698
1301
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -722,8 +1325,8 @@ module PlexRubySDK
|
|
|
722
1325
|
end
|
|
723
1326
|
|
|
724
1327
|
|
|
725
|
-
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetSearchAllLibrariesRequest)).returns(::PlexRubySDK::Operations::GetSearchAllLibrariesResponse) }
|
|
726
|
-
def get_search_all_libraries(request)
|
|
1328
|
+
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetSearchAllLibrariesRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetSearchAllLibrariesResponse) }
|
|
1329
|
+
def get_search_all_libraries(request, timeout_ms = nil)
|
|
727
1330
|
# get_search_all_libraries - Search All Libraries
|
|
728
1331
|
# Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type.
|
|
729
1332
|
#
|
|
@@ -735,11 +1338,61 @@ module PlexRubySDK
|
|
|
735
1338
|
headers['Accept'] = 'application/json'
|
|
736
1339
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
737
1340
|
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
1341
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1342
|
+
|
|
1343
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1344
|
+
timeout ||= @sdk_configuration.timeout
|
|
1345
|
+
|
|
1346
|
+
connection = @sdk_configuration.client
|
|
1347
|
+
|
|
1348
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1349
|
+
base_url: base_url,
|
|
1350
|
+
oauth2_scopes: nil,
|
|
1351
|
+
operation_id: 'get-search-all-libraries',
|
|
1352
|
+
security_source: @sdk_configuration.security_source
|
|
1353
|
+
)
|
|
1354
|
+
|
|
1355
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1356
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1357
|
+
|
|
1358
|
+
begin
|
|
1359
|
+
r = connection.get(url) do |req|
|
|
1360
|
+
req.headers.merge!(headers)
|
|
1361
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1362
|
+
req.params = query_params
|
|
1363
|
+
Utils.configure_request_security(req, security)
|
|
1364
|
+
|
|
1365
|
+
@sdk_configuration.hooks.before_request(
|
|
1366
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1367
|
+
hook_ctx: hook_ctx
|
|
1368
|
+
),
|
|
1369
|
+
request: req
|
|
1370
|
+
)
|
|
1371
|
+
end
|
|
1372
|
+
rescue StandardError => e
|
|
1373
|
+
error = e
|
|
1374
|
+
ensure
|
|
1375
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1376
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1377
|
+
error: error,
|
|
1378
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1379
|
+
hook_ctx: hook_ctx
|
|
1380
|
+
),
|
|
1381
|
+
response: r
|
|
1382
|
+
)
|
|
1383
|
+
else
|
|
1384
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1385
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1386
|
+
hook_ctx: hook_ctx
|
|
1387
|
+
),
|
|
1388
|
+
response: r
|
|
1389
|
+
)
|
|
1390
|
+
end
|
|
1391
|
+
|
|
1392
|
+
if r.nil?
|
|
1393
|
+
raise error if !error.nil?
|
|
1394
|
+
raise 'no response'
|
|
1395
|
+
end
|
|
743
1396
|
end
|
|
744
1397
|
|
|
745
1398
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -768,8 +1421,8 @@ module PlexRubySDK
|
|
|
768
1421
|
end
|
|
769
1422
|
|
|
770
1423
|
|
|
771
|
-
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetMediaMetaDataRequest)).returns(::PlexRubySDK::Operations::GetMediaMetaDataResponse) }
|
|
772
|
-
def get_media_meta_data(request)
|
|
1424
|
+
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetMediaMetaDataRequest), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetMediaMetaDataResponse) }
|
|
1425
|
+
def get_media_meta_data(request, timeout_ms = nil)
|
|
773
1426
|
# get_media_meta_data - Get Media Metadata
|
|
774
1427
|
# This endpoint will return all the (meta)data of a library item specified with by the ratingKey.
|
|
775
1428
|
#
|
|
@@ -786,11 +1439,61 @@ module PlexRubySDK
|
|
|
786
1439
|
headers['Accept'] = 'application/json'
|
|
787
1440
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
788
1441
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
1442
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1443
|
+
|
|
1444
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1445
|
+
timeout ||= @sdk_configuration.timeout
|
|
1446
|
+
|
|
1447
|
+
connection = @sdk_configuration.client
|
|
1448
|
+
|
|
1449
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1450
|
+
base_url: base_url,
|
|
1451
|
+
oauth2_scopes: nil,
|
|
1452
|
+
operation_id: 'get-media-meta-data',
|
|
1453
|
+
security_source: @sdk_configuration.security_source
|
|
1454
|
+
)
|
|
1455
|
+
|
|
1456
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1457
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1458
|
+
|
|
1459
|
+
begin
|
|
1460
|
+
r = connection.get(url) do |req|
|
|
1461
|
+
req.headers.merge!(headers)
|
|
1462
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1463
|
+
req.params = query_params
|
|
1464
|
+
Utils.configure_request_security(req, security)
|
|
1465
|
+
|
|
1466
|
+
@sdk_configuration.hooks.before_request(
|
|
1467
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1468
|
+
hook_ctx: hook_ctx
|
|
1469
|
+
),
|
|
1470
|
+
request: req
|
|
1471
|
+
)
|
|
1472
|
+
end
|
|
1473
|
+
rescue StandardError => e
|
|
1474
|
+
error = e
|
|
1475
|
+
ensure
|
|
1476
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1477
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1478
|
+
error: error,
|
|
1479
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1480
|
+
hook_ctx: hook_ctx
|
|
1481
|
+
),
|
|
1482
|
+
response: r
|
|
1483
|
+
)
|
|
1484
|
+
else
|
|
1485
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1486
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1487
|
+
hook_ctx: hook_ctx
|
|
1488
|
+
),
|
|
1489
|
+
response: r
|
|
1490
|
+
)
|
|
1491
|
+
end
|
|
1492
|
+
|
|
1493
|
+
if r.nil?
|
|
1494
|
+
raise error if !error.nil?
|
|
1495
|
+
raise 'no response'
|
|
1496
|
+
end
|
|
794
1497
|
end
|
|
795
1498
|
|
|
796
1499
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -820,8 +1523,402 @@ module PlexRubySDK
|
|
|
820
1523
|
end
|
|
821
1524
|
|
|
822
1525
|
|
|
823
|
-
sig { params(rating_key: ::
|
|
824
|
-
def
|
|
1526
|
+
sig { params(rating_key: ::Integer, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetMediaArtsResponse) }
|
|
1527
|
+
def get_media_arts(rating_key, timeout_ms = nil)
|
|
1528
|
+
# get_media_arts - Get Media Background Artwork
|
|
1529
|
+
# Returns the background artwork for a library item.
|
|
1530
|
+
request = ::PlexRubySDK::Operations::GetMediaArtsRequest.new(
|
|
1531
|
+
|
|
1532
|
+
rating_key: rating_key
|
|
1533
|
+
)
|
|
1534
|
+
url, params = @sdk_configuration.get_server_details
|
|
1535
|
+
base_url = Utils.template_url(url, params)
|
|
1536
|
+
url = Utils.generate_url(
|
|
1537
|
+
::PlexRubySDK::Operations::GetMediaArtsRequest,
|
|
1538
|
+
base_url,
|
|
1539
|
+
'/library/metadata/{ratingKey}/arts',
|
|
1540
|
+
request
|
|
1541
|
+
)
|
|
1542
|
+
headers = {}
|
|
1543
|
+
headers['Accept'] = 'application/json'
|
|
1544
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1545
|
+
|
|
1546
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1547
|
+
|
|
1548
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1549
|
+
timeout ||= @sdk_configuration.timeout
|
|
1550
|
+
|
|
1551
|
+
connection = @sdk_configuration.client
|
|
1552
|
+
|
|
1553
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1554
|
+
base_url: base_url,
|
|
1555
|
+
oauth2_scopes: nil,
|
|
1556
|
+
operation_id: 'get-media-arts',
|
|
1557
|
+
security_source: @sdk_configuration.security_source
|
|
1558
|
+
)
|
|
1559
|
+
|
|
1560
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1561
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1562
|
+
|
|
1563
|
+
begin
|
|
1564
|
+
r = connection.get(url) do |req|
|
|
1565
|
+
req.headers.merge!(headers)
|
|
1566
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1567
|
+
Utils.configure_request_security(req, security)
|
|
1568
|
+
|
|
1569
|
+
@sdk_configuration.hooks.before_request(
|
|
1570
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1571
|
+
hook_ctx: hook_ctx
|
|
1572
|
+
),
|
|
1573
|
+
request: req
|
|
1574
|
+
)
|
|
1575
|
+
end
|
|
1576
|
+
rescue StandardError => e
|
|
1577
|
+
error = e
|
|
1578
|
+
ensure
|
|
1579
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1580
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1581
|
+
error: error,
|
|
1582
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1583
|
+
hook_ctx: hook_ctx
|
|
1584
|
+
),
|
|
1585
|
+
response: r
|
|
1586
|
+
)
|
|
1587
|
+
else
|
|
1588
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1589
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1590
|
+
hook_ctx: hook_ctx
|
|
1591
|
+
),
|
|
1592
|
+
response: r
|
|
1593
|
+
)
|
|
1594
|
+
end
|
|
1595
|
+
|
|
1596
|
+
if r.nil?
|
|
1597
|
+
raise error if !error.nil?
|
|
1598
|
+
raise 'no response'
|
|
1599
|
+
end
|
|
1600
|
+
end
|
|
1601
|
+
|
|
1602
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1603
|
+
|
|
1604
|
+
res = ::PlexRubySDK::Operations::GetMediaArtsResponse.new(
|
|
1605
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
|
1606
|
+
)
|
|
1607
|
+
if r.status == 200
|
|
1608
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1609
|
+
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetMediaArtsResponseBody)
|
|
1610
|
+
res.object = out
|
|
1611
|
+
end
|
|
1612
|
+
elsif r.status == 404
|
|
1613
|
+
end
|
|
1614
|
+
|
|
1615
|
+
res
|
|
1616
|
+
end
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
sig { params(rating_key: ::Integer, url: T.nilable(::String), request_body: T.nilable(::String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::PostMediaArtsResponse) }
|
|
1620
|
+
def post_media_arts(rating_key, url = nil, request_body = nil, timeout_ms = nil)
|
|
1621
|
+
# post_media_arts - Upload Media Background Artwork
|
|
1622
|
+
# Uploads an image to use as the background artwork for a library item, either from a local file or a remote URL
|
|
1623
|
+
request = ::PlexRubySDK::Operations::PostMediaArtsRequest.new(
|
|
1624
|
+
|
|
1625
|
+
rating_key: rating_key,
|
|
1626
|
+
url: url,
|
|
1627
|
+
request_body: request_body
|
|
1628
|
+
)
|
|
1629
|
+
url, params = @sdk_configuration.get_server_details
|
|
1630
|
+
base_url = Utils.template_url(url, params)
|
|
1631
|
+
url = Utils.generate_url(
|
|
1632
|
+
::PlexRubySDK::Operations::PostMediaArtsRequest,
|
|
1633
|
+
base_url,
|
|
1634
|
+
'/library/metadata/{ratingKey}/arts',
|
|
1635
|
+
request
|
|
1636
|
+
)
|
|
1637
|
+
headers = {}
|
|
1638
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :raw)
|
|
1639
|
+
headers['content-type'] = req_content_type
|
|
1640
|
+
|
|
1641
|
+
if form
|
|
1642
|
+
body = Utils.encode_form(form)
|
|
1643
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1644
|
+
body = URI.encode_www_form(data)
|
|
1645
|
+
else
|
|
1646
|
+
body = data
|
|
1647
|
+
end
|
|
1648
|
+
query_params = Utils.get_query_params(::PlexRubySDK::Operations::PostMediaArtsRequest, request)
|
|
1649
|
+
headers['Accept'] = '*/*'
|
|
1650
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1651
|
+
|
|
1652
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1653
|
+
|
|
1654
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1655
|
+
timeout ||= @sdk_configuration.timeout
|
|
1656
|
+
|
|
1657
|
+
connection = @sdk_configuration.client
|
|
1658
|
+
|
|
1659
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1660
|
+
base_url: base_url,
|
|
1661
|
+
oauth2_scopes: nil,
|
|
1662
|
+
operation_id: 'post-media-arts',
|
|
1663
|
+
security_source: @sdk_configuration.security_source
|
|
1664
|
+
)
|
|
1665
|
+
|
|
1666
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1667
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1668
|
+
|
|
1669
|
+
begin
|
|
1670
|
+
r = connection.post(url) do |req|
|
|
1671
|
+
req.body = body
|
|
1672
|
+
req.headers.merge!(headers)
|
|
1673
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1674
|
+
req.params = query_params
|
|
1675
|
+
Utils.configure_request_security(req, security)
|
|
1676
|
+
|
|
1677
|
+
@sdk_configuration.hooks.before_request(
|
|
1678
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1679
|
+
hook_ctx: hook_ctx
|
|
1680
|
+
),
|
|
1681
|
+
request: req
|
|
1682
|
+
)
|
|
1683
|
+
end
|
|
1684
|
+
rescue StandardError => e
|
|
1685
|
+
error = e
|
|
1686
|
+
ensure
|
|
1687
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1688
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1689
|
+
error: error,
|
|
1690
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1691
|
+
hook_ctx: hook_ctx
|
|
1692
|
+
),
|
|
1693
|
+
response: r
|
|
1694
|
+
)
|
|
1695
|
+
else
|
|
1696
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1697
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1698
|
+
hook_ctx: hook_ctx
|
|
1699
|
+
),
|
|
1700
|
+
response: r
|
|
1701
|
+
)
|
|
1702
|
+
end
|
|
1703
|
+
|
|
1704
|
+
if r.nil?
|
|
1705
|
+
raise error if !error.nil?
|
|
1706
|
+
raise 'no response'
|
|
1707
|
+
end
|
|
1708
|
+
end
|
|
1709
|
+
|
|
1710
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1711
|
+
|
|
1712
|
+
res = ::PlexRubySDK::Operations::PostMediaArtsResponse.new(
|
|
1713
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
|
1714
|
+
)
|
|
1715
|
+
if r.status == 200
|
|
1716
|
+
elsif r.status == 404
|
|
1717
|
+
end
|
|
1718
|
+
|
|
1719
|
+
res
|
|
1720
|
+
end
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
sig { params(rating_key: ::Integer, timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetMediaPostersResponse) }
|
|
1724
|
+
def get_media_posters(rating_key, timeout_ms = nil)
|
|
1725
|
+
# get_media_posters - Get Media Posters
|
|
1726
|
+
# Returns the available posters for a library item.
|
|
1727
|
+
request = ::PlexRubySDK::Operations::GetMediaPostersRequest.new(
|
|
1728
|
+
|
|
1729
|
+
rating_key: rating_key
|
|
1730
|
+
)
|
|
1731
|
+
url, params = @sdk_configuration.get_server_details
|
|
1732
|
+
base_url = Utils.template_url(url, params)
|
|
1733
|
+
url = Utils.generate_url(
|
|
1734
|
+
::PlexRubySDK::Operations::GetMediaPostersRequest,
|
|
1735
|
+
base_url,
|
|
1736
|
+
'/library/metadata/{ratingKey}/posters',
|
|
1737
|
+
request
|
|
1738
|
+
)
|
|
1739
|
+
headers = {}
|
|
1740
|
+
headers['Accept'] = 'application/json'
|
|
1741
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1742
|
+
|
|
1743
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1744
|
+
|
|
1745
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1746
|
+
timeout ||= @sdk_configuration.timeout
|
|
1747
|
+
|
|
1748
|
+
connection = @sdk_configuration.client
|
|
1749
|
+
|
|
1750
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1751
|
+
base_url: base_url,
|
|
1752
|
+
oauth2_scopes: nil,
|
|
1753
|
+
operation_id: 'get-media-posters',
|
|
1754
|
+
security_source: @sdk_configuration.security_source
|
|
1755
|
+
)
|
|
1756
|
+
|
|
1757
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1758
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1759
|
+
|
|
1760
|
+
begin
|
|
1761
|
+
r = connection.get(url) do |req|
|
|
1762
|
+
req.headers.merge!(headers)
|
|
1763
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1764
|
+
Utils.configure_request_security(req, security)
|
|
1765
|
+
|
|
1766
|
+
@sdk_configuration.hooks.before_request(
|
|
1767
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1768
|
+
hook_ctx: hook_ctx
|
|
1769
|
+
),
|
|
1770
|
+
request: req
|
|
1771
|
+
)
|
|
1772
|
+
end
|
|
1773
|
+
rescue StandardError => e
|
|
1774
|
+
error = e
|
|
1775
|
+
ensure
|
|
1776
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1777
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1778
|
+
error: error,
|
|
1779
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1780
|
+
hook_ctx: hook_ctx
|
|
1781
|
+
),
|
|
1782
|
+
response: r
|
|
1783
|
+
)
|
|
1784
|
+
else
|
|
1785
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1786
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1787
|
+
hook_ctx: hook_ctx
|
|
1788
|
+
),
|
|
1789
|
+
response: r
|
|
1790
|
+
)
|
|
1791
|
+
end
|
|
1792
|
+
|
|
1793
|
+
if r.nil?
|
|
1794
|
+
raise error if !error.nil?
|
|
1795
|
+
raise 'no response'
|
|
1796
|
+
end
|
|
1797
|
+
end
|
|
1798
|
+
|
|
1799
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1800
|
+
|
|
1801
|
+
res = ::PlexRubySDK::Operations::GetMediaPostersResponse.new(
|
|
1802
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
|
1803
|
+
)
|
|
1804
|
+
if r.status == 200
|
|
1805
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1806
|
+
out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::PlexRubySDK::Operations::GetMediaPostersResponseBody)
|
|
1807
|
+
res.object = out
|
|
1808
|
+
end
|
|
1809
|
+
elsif r.status == 404
|
|
1810
|
+
end
|
|
1811
|
+
|
|
1812
|
+
res
|
|
1813
|
+
end
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
sig { params(rating_key: ::Integer, url: T.nilable(::String), request_body: T.nilable(::String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::PostMediaPosterResponse) }
|
|
1817
|
+
def post_media_poster(rating_key, url = nil, request_body = nil, timeout_ms = nil)
|
|
1818
|
+
# post_media_poster - Upload Media Poster
|
|
1819
|
+
# Uploads a poster to a library item, either from a local file or a remote URL
|
|
1820
|
+
request = ::PlexRubySDK::Operations::PostMediaPosterRequest.new(
|
|
1821
|
+
|
|
1822
|
+
rating_key: rating_key,
|
|
1823
|
+
url: url,
|
|
1824
|
+
request_body: request_body
|
|
1825
|
+
)
|
|
1826
|
+
url, params = @sdk_configuration.get_server_details
|
|
1827
|
+
base_url = Utils.template_url(url, params)
|
|
1828
|
+
url = Utils.generate_url(
|
|
1829
|
+
::PlexRubySDK::Operations::PostMediaPosterRequest,
|
|
1830
|
+
base_url,
|
|
1831
|
+
'/library/metadata/{ratingKey}/posters',
|
|
1832
|
+
request
|
|
1833
|
+
)
|
|
1834
|
+
headers = {}
|
|
1835
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :raw)
|
|
1836
|
+
headers['content-type'] = req_content_type
|
|
1837
|
+
|
|
1838
|
+
if form
|
|
1839
|
+
body = Utils.encode_form(form)
|
|
1840
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1841
|
+
body = URI.encode_www_form(data)
|
|
1842
|
+
else
|
|
1843
|
+
body = data
|
|
1844
|
+
end
|
|
1845
|
+
query_params = Utils.get_query_params(::PlexRubySDK::Operations::PostMediaPosterRequest, request)
|
|
1846
|
+
headers['Accept'] = '*/*'
|
|
1847
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1848
|
+
|
|
1849
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1850
|
+
|
|
1851
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1852
|
+
timeout ||= @sdk_configuration.timeout
|
|
1853
|
+
|
|
1854
|
+
connection = @sdk_configuration.client
|
|
1855
|
+
|
|
1856
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1857
|
+
base_url: base_url,
|
|
1858
|
+
oauth2_scopes: nil,
|
|
1859
|
+
operation_id: 'post-media-poster',
|
|
1860
|
+
security_source: @sdk_configuration.security_source
|
|
1861
|
+
)
|
|
1862
|
+
|
|
1863
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1864
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1865
|
+
|
|
1866
|
+
begin
|
|
1867
|
+
r = connection.post(url) do |req|
|
|
1868
|
+
req.body = body
|
|
1869
|
+
req.headers.merge!(headers)
|
|
1870
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1871
|
+
req.params = query_params
|
|
1872
|
+
Utils.configure_request_security(req, security)
|
|
1873
|
+
|
|
1874
|
+
@sdk_configuration.hooks.before_request(
|
|
1875
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1876
|
+
hook_ctx: hook_ctx
|
|
1877
|
+
),
|
|
1878
|
+
request: req
|
|
1879
|
+
)
|
|
1880
|
+
end
|
|
1881
|
+
rescue StandardError => e
|
|
1882
|
+
error = e
|
|
1883
|
+
ensure
|
|
1884
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1885
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1886
|
+
error: error,
|
|
1887
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1888
|
+
hook_ctx: hook_ctx
|
|
1889
|
+
),
|
|
1890
|
+
response: r
|
|
1891
|
+
)
|
|
1892
|
+
else
|
|
1893
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1894
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1895
|
+
hook_ctx: hook_ctx
|
|
1896
|
+
),
|
|
1897
|
+
response: r
|
|
1898
|
+
)
|
|
1899
|
+
end
|
|
1900
|
+
|
|
1901
|
+
if r.nil?
|
|
1902
|
+
raise error if !error.nil?
|
|
1903
|
+
raise 'no response'
|
|
1904
|
+
end
|
|
1905
|
+
end
|
|
1906
|
+
|
|
1907
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1908
|
+
|
|
1909
|
+
res = ::PlexRubySDK::Operations::PostMediaPosterResponse.new(
|
|
1910
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
|
1911
|
+
)
|
|
1912
|
+
if r.status == 200
|
|
1913
|
+
elsif r.status == 404
|
|
1914
|
+
end
|
|
1915
|
+
|
|
1916
|
+
res
|
|
1917
|
+
end
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
sig { params(rating_key: ::Float, include_elements: T.nilable(::String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetMetadataChildrenResponse) }
|
|
1921
|
+
def get_metadata_children(rating_key, include_elements = nil, timeout_ms = nil)
|
|
825
1922
|
# get_metadata_children - Get Items Children
|
|
826
1923
|
# This endpoint will return the children of of a library item specified with the ratingKey.
|
|
827
1924
|
#
|
|
@@ -843,11 +1940,61 @@ module PlexRubySDK
|
|
|
843
1940
|
headers['Accept'] = 'application/json'
|
|
844
1941
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
845
1942
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1943
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
1944
|
+
|
|
1945
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1946
|
+
timeout ||= @sdk_configuration.timeout
|
|
1947
|
+
|
|
1948
|
+
connection = @sdk_configuration.client
|
|
1949
|
+
|
|
1950
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1951
|
+
base_url: base_url,
|
|
1952
|
+
oauth2_scopes: nil,
|
|
1953
|
+
operation_id: 'getMetadataChildren',
|
|
1954
|
+
security_source: @sdk_configuration.security_source
|
|
1955
|
+
)
|
|
1956
|
+
|
|
1957
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
1958
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
1959
|
+
|
|
1960
|
+
begin
|
|
1961
|
+
r = connection.get(url) do |req|
|
|
1962
|
+
req.headers.merge!(headers)
|
|
1963
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1964
|
+
req.params = query_params
|
|
1965
|
+
Utils.configure_request_security(req, security)
|
|
1966
|
+
|
|
1967
|
+
@sdk_configuration.hooks.before_request(
|
|
1968
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1969
|
+
hook_ctx: hook_ctx
|
|
1970
|
+
),
|
|
1971
|
+
request: req
|
|
1972
|
+
)
|
|
1973
|
+
end
|
|
1974
|
+
rescue StandardError => e
|
|
1975
|
+
error = e
|
|
1976
|
+
ensure
|
|
1977
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
1978
|
+
r = @sdk_configuration.hooks.after_error(
|
|
1979
|
+
error: error,
|
|
1980
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1981
|
+
hook_ctx: hook_ctx
|
|
1982
|
+
),
|
|
1983
|
+
response: r
|
|
1984
|
+
)
|
|
1985
|
+
else
|
|
1986
|
+
r = @sdk_configuration.hooks.after_success(
|
|
1987
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1988
|
+
hook_ctx: hook_ctx
|
|
1989
|
+
),
|
|
1990
|
+
response: r
|
|
1991
|
+
)
|
|
1992
|
+
end
|
|
1993
|
+
|
|
1994
|
+
if r.nil?
|
|
1995
|
+
raise error if !error.nil?
|
|
1996
|
+
raise 'no response'
|
|
1997
|
+
end
|
|
851
1998
|
end
|
|
852
1999
|
|
|
853
2000
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
|
@@ -876,8 +2023,8 @@ module PlexRubySDK
|
|
|
876
2023
|
end
|
|
877
2024
|
|
|
878
2025
|
|
|
879
|
-
sig { params(type: ::PlexRubySDK::Operations::GetTopWatchedContentQueryParamType, include_guids: T.nilable(::Integer)).returns(::PlexRubySDK::Operations::GetTopWatchedContentResponse) }
|
|
880
|
-
def get_top_watched_content(type, include_guids = nil)
|
|
2026
|
+
sig { params(type: ::PlexRubySDK::Operations::GetTopWatchedContentQueryParamType, include_guids: T.nilable(::Integer), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetTopWatchedContentResponse) }
|
|
2027
|
+
def get_top_watched_content(type, include_guids = nil, timeout_ms = nil)
|
|
881
2028
|
# get_top_watched_content - Get Top Watched Content
|
|
882
2029
|
# This endpoint will return the top watched content from libraries of a certain type
|
|
883
2030
|
#
|
|
@@ -894,11 +2041,61 @@ module PlexRubySDK
|
|
|
894
2041
|
headers['Accept'] = 'application/json'
|
|
895
2042
|
headers['user-agent'] = @sdk_configuration.user_agent
|
|
896
2043
|
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
2044
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
|
2045
|
+
|
|
2046
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
2047
|
+
timeout ||= @sdk_configuration.timeout
|
|
2048
|
+
|
|
2049
|
+
connection = @sdk_configuration.client
|
|
2050
|
+
|
|
2051
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
2052
|
+
base_url: base_url,
|
|
2053
|
+
oauth2_scopes: nil,
|
|
2054
|
+
operation_id: 'getTopWatchedContent',
|
|
2055
|
+
security_source: @sdk_configuration.security_source
|
|
2056
|
+
)
|
|
2057
|
+
|
|
2058
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
2059
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
|
2060
|
+
|
|
2061
|
+
begin
|
|
2062
|
+
r = connection.get(url) do |req|
|
|
2063
|
+
req.headers.merge!(headers)
|
|
2064
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
2065
|
+
req.params = query_params
|
|
2066
|
+
Utils.configure_request_security(req, security)
|
|
2067
|
+
|
|
2068
|
+
@sdk_configuration.hooks.before_request(
|
|
2069
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
2070
|
+
hook_ctx: hook_ctx
|
|
2071
|
+
),
|
|
2072
|
+
request: req
|
|
2073
|
+
)
|
|
2074
|
+
end
|
|
2075
|
+
rescue StandardError => e
|
|
2076
|
+
error = e
|
|
2077
|
+
ensure
|
|
2078
|
+
if r.nil? || Utils.error_status?(r.status)
|
|
2079
|
+
r = @sdk_configuration.hooks.after_error(
|
|
2080
|
+
error: error,
|
|
2081
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
2082
|
+
hook_ctx: hook_ctx
|
|
2083
|
+
),
|
|
2084
|
+
response: r
|
|
2085
|
+
)
|
|
2086
|
+
else
|
|
2087
|
+
r = @sdk_configuration.hooks.after_success(
|
|
2088
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2089
|
+
hook_ctx: hook_ctx
|
|
2090
|
+
),
|
|
2091
|
+
response: r
|
|
2092
|
+
)
|
|
2093
|
+
end
|
|
2094
|
+
|
|
2095
|
+
if r.nil?
|
|
2096
|
+
raise error if !error.nil?
|
|
2097
|
+
raise 'no response'
|
|
2098
|
+
end
|
|
902
2099
|
end
|
|
903
2100
|
|
|
904
2101
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|