mirror of
https://github.com/LukeHagar/plexpy.git
synced 2025-12-06 04:20:52 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.198.1
This commit is contained in:
@@ -4,9 +4,9 @@ management:
|
|||||||
docChecksum: e34dac84738ebf2d447ea2b9055a6eeb
|
docChecksum: e34dac84738ebf2d447ea2b9055a6eeb
|
||||||
docVersion: 0.0.3
|
docVersion: 0.0.3
|
||||||
speakeasyVersion: internal
|
speakeasyVersion: internal
|
||||||
generationVersion: 2.272.4
|
generationVersion: 2.275.4
|
||||||
releaseVersion: 0.2.1
|
releaseVersion: 0.3.0
|
||||||
configChecksum: 7495c103921e1dcc54066a6ddc49966d
|
configChecksum: 1df7c31fecec61686c8b5f29f2f6df8e
|
||||||
repoURL: https://github.com/LukeHagar/plexpy.git
|
repoURL: https://github.com/LukeHagar/plexpy.git
|
||||||
repoSubDirectory: .
|
repoSubDirectory: .
|
||||||
installationURL: https://github.com/LukeHagar/plexpy.git
|
installationURL: https://github.com/LukeHagar/plexpy.git
|
||||||
@@ -14,9 +14,9 @@ management:
|
|||||||
features:
|
features:
|
||||||
python:
|
python:
|
||||||
constsAndDefaults: 0.1.2
|
constsAndDefaults: 0.1.2
|
||||||
core: 4.4.7
|
core: 4.5.0
|
||||||
flattening: 2.81.1
|
flattening: 2.81.1
|
||||||
globalSecurity: 2.83.3
|
globalSecurity: 2.83.4
|
||||||
globalServerURLs: 2.82.1
|
globalServerURLs: 2.82.1
|
||||||
methodServerURLs: 2.82.1
|
methodServerURLs: 2.82.1
|
||||||
nameOverrides: 2.81.1
|
nameOverrides: 2.81.1
|
||||||
@@ -585,3 +585,6 @@ generatedFiles:
|
|||||||
- docs/sdks/updater/README.md
|
- docs/sdks/updater/README.md
|
||||||
- USAGE.md
|
- USAGE.md
|
||||||
- .gitattributes
|
- .gitattributes
|
||||||
|
- src/plex_api/_hooks/sdkhooks.py
|
||||||
|
- src/plex_api/_hooks/types.py
|
||||||
|
- src/plex_api/_hooks/__init__.py
|
||||||
|
|||||||
12
RELEASES.md
12
RELEASES.md
@@ -58,4 +58,14 @@ Based on:
|
|||||||
### Generated
|
### Generated
|
||||||
- [python v0.2.1] .
|
- [python v0.2.1] .
|
||||||
### Releases
|
### Releases
|
||||||
- [PyPI v0.2.1] https://pypi.org/project/plex-api-client/0.2.1 - .
|
- [PyPI v0.2.1] https://pypi.org/project/plex-api-client/0.2.1 - .
|
||||||
|
|
||||||
|
## 2024-03-01 01:16:44
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc 0.0.3
|
||||||
|
- Speakeasy CLI 1.198.1 (2.275.4) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [python v0.3.0] .
|
||||||
|
### Releases
|
||||||
|
- [PyPI v0.3.0] https://pypi.org/project/plex-api-client/0.3.0 - .
|
||||||
@@ -231,7 +231,7 @@ req = operations.GetResizedPhotoRequest(
|
|||||||
min_size=operations.MinSize.ONE,
|
min_size=operations.MinSize.ONE,
|
||||||
upscale=operations.Upscale.ZERO,
|
upscale=operations.Upscale.ZERO,
|
||||||
url='/library/metadata/49564/thumb/1654258204',
|
url='/library/metadata/49564/thumb/1654258204',
|
||||||
opacity=209783,
|
opacity=100,
|
||||||
)
|
)
|
||||||
|
|
||||||
res = s.server.get_resized_photo(req)
|
res = s.server.get_resized_photo(req)
|
||||||
|
|||||||
6
gen.yaml
6
gen.yaml
@@ -12,7 +12,11 @@ generation:
|
|||||||
auth:
|
auth:
|
||||||
oAuth2ClientCredentialsEnabled: false
|
oAuth2ClientCredentialsEnabled: false
|
||||||
python:
|
python:
|
||||||
version: 0.2.1
|
version: 0.3.0
|
||||||
|
additionalDependencies:
|
||||||
|
dependencies: {}
|
||||||
|
extraDependencies:
|
||||||
|
dev: {}
|
||||||
author: LukeHagar
|
author: LukeHagar
|
||||||
clientServerStatusCodesAsErrors: true
|
clientServerStatusCodesAsErrors: true
|
||||||
description: Python Client SDK Generated by Speakeasy
|
description: Python Client SDK Generated by Speakeasy
|
||||||
|
|||||||
1
pylintrc
1
pylintrc
@@ -180,6 +180,7 @@ good-names=i,
|
|||||||
ex,
|
ex,
|
||||||
Run,
|
Run,
|
||||||
_,
|
_,
|
||||||
|
e,
|
||||||
ip,
|
ip,
|
||||||
id,
|
id,
|
||||||
qr,
|
qr,
|
||||||
|
|||||||
10
setup.py
10
setup.py
@@ -10,7 +10,7 @@ except FileNotFoundError:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="plex-api-client",
|
name="plex-api-client",
|
||||||
version="0.2.1",
|
version="0.3.0",
|
||||||
author="LukeHagar",
|
author="LukeHagar",
|
||||||
description="Python Client SDK Generated by Speakeasy",
|
description="Python Client SDK Generated by Speakeasy",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
@@ -19,9 +19,9 @@ setuptools.setup(
|
|||||||
install_requires=[
|
install_requires=[
|
||||||
"certifi>=2023.7.22",
|
"certifi>=2023.7.22",
|
||||||
"charset-normalizer>=3.2.0",
|
"charset-normalizer>=3.2.0",
|
||||||
"dataclasses-json-speakeasy>=0.5.11",
|
"dataclasses-json>=0.6.4",
|
||||||
"idna>=3.4",
|
"idna>=3.4",
|
||||||
"jsonpath-python>=1.0.6 ",
|
"jsonpath-python>=1.0.6",
|
||||||
"marshmallow>=3.19.0",
|
"marshmallow>=3.19.0",
|
||||||
"mypy-extensions>=1.0.0",
|
"mypy-extensions>=1.0.0",
|
||||||
"packaging>=23.1",
|
"packaging>=23.1",
|
||||||
@@ -33,7 +33,9 @@ setuptools.setup(
|
|||||||
"urllib3>=1.26.18",
|
"urllib3>=1.26.18",
|
||||||
],
|
],
|
||||||
extras_require={
|
extras_require={
|
||||||
"dev":["pylint==2.16.2"]
|
"dev": [
|
||||||
|
"pylint==2.16.2",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
package_dir={'': 'src'},
|
package_dir={'': 'src'},
|
||||||
python_requires='>=3.8',
|
python_requires='>=3.8',
|
||||||
|
|||||||
4
src/plex_api/_hooks/__init__.py
Normal file
4
src/plex_api/_hooks/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
from .sdkhooks import *
|
||||||
|
from .types import *
|
||||||
55
src/plex_api/_hooks/sdkhooks.py
Normal file
55
src/plex_api/_hooks/sdkhooks.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks
|
||||||
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
|
|
||||||
|
class SDKHooks(Hooks):
|
||||||
|
sdk_init_hooks: List[SDKInitHook] = []
|
||||||
|
before_request_hooks: List[BeforeRequestHook] = []
|
||||||
|
after_success_hooks: List[AfterSuccessHook] = []
|
||||||
|
after_error_hooks: List[AfterErrorHook] = []
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
|
||||||
|
self.sdk_init_hooks.append(hook)
|
||||||
|
|
||||||
|
def register_before_request_hook(self, hook: BeforeRequestHook) -> None:
|
||||||
|
self.before_request_hooks.append(hook)
|
||||||
|
|
||||||
|
def register_after_success_hook(self, hook: AfterSuccessHook) -> None:
|
||||||
|
self.after_success_hooks.append(hook)
|
||||||
|
|
||||||
|
def register_after_error_hook(self, hook: AfterErrorHook) -> None:
|
||||||
|
self.after_error_hooks.append(hook)
|
||||||
|
|
||||||
|
def sdk_init(self, base_url: str, client: requests.Session) -> Tuple[str, requests.Session]:
|
||||||
|
for hook in self.sdk_init_hooks:
|
||||||
|
base_url, client = hook.sdk_init(base_url, client)
|
||||||
|
return base_url, client
|
||||||
|
|
||||||
|
def before_request(self, hook_ctx: BeforeRequestContext, request: requests.PreparedRequest) -> Union[requests.PreparedRequest, Exception]:
|
||||||
|
for hook in self.before_request_hooks:
|
||||||
|
request = hook.before_request(hook_ctx, request)
|
||||||
|
if isinstance(request, Exception):
|
||||||
|
raise request
|
||||||
|
|
||||||
|
return request
|
||||||
|
|
||||||
|
def after_success(self, hook_ctx: AfterSuccessContext, response: requests.Response) -> requests.Response:
|
||||||
|
for hook in self.after_success_hooks:
|
||||||
|
response = hook.after_success(hook_ctx, response)
|
||||||
|
if isinstance(response, Exception):
|
||||||
|
raise response
|
||||||
|
return response
|
||||||
|
|
||||||
|
def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests.Response], error: Optional[Exception]) -> Tuple[Optional[requests.Response], Optional[Exception]]:
|
||||||
|
for hook in self.after_error_hooks:
|
||||||
|
result = hook.after_error(hook_ctx, response, error)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
response, error = result
|
||||||
|
return response, error
|
||||||
70
src/plex_api/_hooks/types.py
Normal file
70
src/plex_api/_hooks/types.py
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
|
from typing import Any, Callable, List, Optional, Tuple, Union
|
||||||
|
|
||||||
|
|
||||||
|
class HookContext:
|
||||||
|
operation_id: str
|
||||||
|
oauth2_scopes: Optional[List[str]] = None
|
||||||
|
security_source: Optional[Union[Any, Callable[[], Any]]] = None
|
||||||
|
|
||||||
|
def __init__(self, operation_id: str, oauth2_scopes: Optional[List[str]], security_source: Optional[Union[Any, Callable[[], Any]]]):
|
||||||
|
self.operation_id = operation_id
|
||||||
|
self.oauth2_scopes = oauth2_scopes
|
||||||
|
self.security_source = security_source
|
||||||
|
|
||||||
|
|
||||||
|
class BeforeRequestContext(HookContext):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AfterSuccessContext(HookContext):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AfterErrorContext(HookContext):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SDKInitHook(ABC):
|
||||||
|
@abstractmethod
|
||||||
|
def sdk_init(self, base_url: str, client: requests_http.Session) -> Tuple[str, requests_http.Session]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class BeforeRequestHook(ABC):
|
||||||
|
@abstractmethod
|
||||||
|
def before_request(self, hook_ctx: BeforeRequestContext, request: requests_http.PreparedRequest) -> Union[requests_http.PreparedRequest, Exception]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AfterSuccessHook(ABC):
|
||||||
|
@abstractmethod
|
||||||
|
def after_success(self, hook_ctx: AfterSuccessContext, response: requests_http.Response) -> Union[requests_http.PreparedRequest, Exception]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AfterErrorHook(ABC):
|
||||||
|
@abstractmethod
|
||||||
|
def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests_http.Response], error: Optional[Exception]) -> Union[Tuple[Optional[requests_http.PreparedRequest], Optional[Exception]], Exception]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Hooks(ABC):
|
||||||
|
@abstractmethod
|
||||||
|
def register_sdk_init_hook(self, hook: SDKInitHook):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def register_before_request_hook(self, hook: BeforeRequestHook):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def register_after_success_hook(self, hook: AfterSuccessHook):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def register_after_error_hook(self, hook: AfterErrorHook):
|
||||||
|
pass
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -25,6 +27,7 @@ class Activities:
|
|||||||
r"""Get Server Activities
|
r"""Get Server Activities
|
||||||
Get Server Activities
|
Get Server Activities
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getServerActivities', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/activities'
|
url = base_url + '/activities'
|
||||||
@@ -37,7 +40,27 @@ class Activities:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetServerActivitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetServerActivitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -66,6 +89,7 @@ class Activities:
|
|||||||
r"""Cancel Server Activities
|
r"""Cancel Server Activities
|
||||||
Cancel Server Activities
|
Cancel Server Activities
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='cancelServerActivities', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.CancelServerActivitiesRequest(
|
request = operations.CancelServerActivitiesRequest(
|
||||||
activity_uuid=activity_uuid,
|
activity_uuid=activity_uuid,
|
||||||
)
|
)
|
||||||
@@ -82,7 +106,27 @@ class Activities:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('DELETE', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('DELETE', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.CancelServerActivitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.CancelServerActivitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
|
|
||||||
class Authentication:
|
class Authentication:
|
||||||
@@ -17,6 +19,7 @@ class Authentication:
|
|||||||
r"""Get a Transient Token.
|
r"""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.
|
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.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getTransientToken', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetTransientTokenRequest(
|
request = operations.GetTransientTokenRequest(
|
||||||
type=type_,
|
type=type_,
|
||||||
scope=scope,
|
scope=scope,
|
||||||
@@ -35,7 +38,27 @@ class Authentication:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetTransientTokenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetTransientTokenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -61,6 +84,7 @@ class Authentication:
|
|||||||
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.
|
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.
|
Note: requires Plex Media Server >= 1.15.4.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getSourceConnectionInformation', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetSourceConnectionInformationRequest(
|
request = operations.GetSourceConnectionInformationRequest(
|
||||||
source=source,
|
source=source,
|
||||||
)
|
)
|
||||||
@@ -78,7 +102,27 @@ class Authentication:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetSourceConnectionInformationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetSourceConnectionInformationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ class Butler:
|
|||||||
r"""Get Butler tasks
|
r"""Get Butler tasks
|
||||||
Returns a list of butler tasks
|
Returns a list of butler tasks
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getButlerTasks', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/butler'
|
url = base_url + '/butler'
|
||||||
@@ -30,7 +33,27 @@ class Butler:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetButlerTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetButlerTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -63,6 +86,7 @@ class Butler:
|
|||||||
3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
|
3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
|
||||||
4. If we are outside the configured window, the task will start immediately.
|
4. If we are outside the configured window, the task will start immediately.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='startAllTasks', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/butler'
|
url = base_url + '/butler'
|
||||||
@@ -75,7 +99,27 @@ class Butler:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('POST', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('POST', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.StartAllTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.StartAllTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -100,6 +144,7 @@ class Butler:
|
|||||||
r"""Stop all Butler tasks
|
r"""Stop all Butler tasks
|
||||||
This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
|
This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='stopAllTasks', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/butler'
|
url = base_url + '/butler'
|
||||||
@@ -112,7 +157,27 @@ class Butler:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('DELETE', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('DELETE', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.StopAllTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.StopAllTasksResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -141,6 +206,7 @@ class Butler:
|
|||||||
3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
|
3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
|
||||||
4. If we are outside the configured window, the task will start immediately.
|
4. If we are outside the configured window, the task will start immediately.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='startTask', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.StartTaskRequest(
|
request = operations.StartTaskRequest(
|
||||||
task_name=task_name,
|
task_name=task_name,
|
||||||
)
|
)
|
||||||
@@ -157,7 +223,27 @@ class Butler:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('POST', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('POST', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.StartTaskResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.StartTaskResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -182,6 +268,7 @@ class Butler:
|
|||||||
r"""Stop a single Butler task
|
r"""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.
|
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.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='stopTask', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.StopTaskRequest(
|
request = operations.StopTaskRequest(
|
||||||
task_name=task_name,
|
task_name=task_name,
|
||||||
)
|
)
|
||||||
@@ -198,7 +285,27 @@ class Butler:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('DELETE', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('DELETE', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','404','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.StopTaskResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.StopTaskResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ class Hubs:
|
|||||||
r"""Get Global Hubs
|
r"""Get Global Hubs
|
||||||
Get Global Hubs filtered by the parameters provided.
|
Get Global Hubs filtered by the parameters provided.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getGlobalHubs', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetGlobalHubsRequest(
|
request = operations.GetGlobalHubsRequest(
|
||||||
count=count,
|
count=count,
|
||||||
only_transient=only_transient,
|
only_transient=only_transient,
|
||||||
@@ -36,7 +39,27 @@ class Hubs:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetGlobalHubsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetGlobalHubsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -65,6 +88,7 @@ class Hubs:
|
|||||||
r"""Get library specific hubs
|
r"""Get library specific hubs
|
||||||
This endpoint will return a list of library specific hubs
|
This endpoint will return a list of library specific hubs
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getLibraryHubs', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetLibraryHubsRequest(
|
request = operations.GetLibraryHubsRequest(
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
count=count,
|
count=count,
|
||||||
@@ -84,7 +108,27 @@ class Hubs:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetLibraryHubsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetLibraryHubsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ class Library:
|
|||||||
r"""Get Hash Value
|
r"""Get Hash Value
|
||||||
This resource returns hash values for local files
|
This resource returns hash values for local files
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getFileHash', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetFileHashRequest(
|
request = operations.GetFileHashRequest(
|
||||||
url=url,
|
url=url,
|
||||||
type=type_,
|
type=type_,
|
||||||
@@ -36,7 +39,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetFileHashResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetFileHashResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -61,6 +84,7 @@ class Library:
|
|||||||
r"""Get Recently Added
|
r"""Get Recently Added
|
||||||
This endpoint will return the recently added content.
|
This endpoint will return the recently added content.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getRecentlyAdded', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/library/recentlyAdded'
|
url = base_url + '/library/recentlyAdded'
|
||||||
@@ -73,7 +97,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetRecentlyAddedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetRecentlyAddedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -107,6 +151,7 @@ class Library:
|
|||||||
Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts.
|
Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts.
|
||||||
This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year).
|
This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year).
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getLibraries', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/library/sections'
|
url = base_url + '/library/sections'
|
||||||
@@ -119,7 +164,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetLibrariesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetLibrariesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -186,6 +251,7 @@ class Library:
|
|||||||
|
|
||||||
> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
|
> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getLibrary', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetLibraryRequest(
|
request = operations.GetLibraryRequest(
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
include_details=include_details,
|
include_details=include_details,
|
||||||
@@ -204,7 +270,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -233,6 +319,7 @@ class Library:
|
|||||||
r"""Delete Library Section
|
r"""Delete Library Section
|
||||||
Delate a library using a specific section
|
Delate a library using a specific section
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='deleteLibrary', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.DeleteLibraryRequest(
|
request = operations.DeleteLibraryRequest(
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
)
|
)
|
||||||
@@ -249,7 +336,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('DELETE', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('DELETE', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.DeleteLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.DeleteLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -293,6 +400,7 @@ class Library:
|
|||||||
- `firstCharacter`: Items categorized by the first letter.
|
- `firstCharacter`: Items categorized by the first letter.
|
||||||
- `folder`: Items categorized by folder.
|
- `folder`: Items categorized by folder.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getLibraryItems', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetLibraryItemsRequest(
|
request = operations.GetLibraryItemsRequest(
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
tag=tag,
|
tag=tag,
|
||||||
@@ -310,7 +418,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetLibraryItemsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetLibraryItemsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -332,6 +460,7 @@ class Library:
|
|||||||
r"""Refresh Library
|
r"""Refresh Library
|
||||||
This endpoint Refreshes the library.
|
This endpoint Refreshes the library.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='refreshLibrary', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.RefreshLibraryRequest(
|
request = operations.RefreshLibraryRequest(
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
)
|
)
|
||||||
@@ -348,7 +477,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.RefreshLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.RefreshLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -390,6 +539,7 @@ class Library:
|
|||||||
|
|
||||||
> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
|
> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='searchLibrary', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.SearchLibraryRequest(
|
request = operations.SearchLibraryRequest(
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
type=type_,
|
type=type_,
|
||||||
@@ -408,7 +558,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.SearchLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.SearchLibraryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -430,6 +600,7 @@ class Library:
|
|||||||
r"""Get Items Metadata
|
r"""Get Items Metadata
|
||||||
This endpoint will return the metadata of a library item specified with the ratingKey.
|
This endpoint will return the metadata of a library item specified with the ratingKey.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getMetadata', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetMetadataRequest(
|
request = operations.GetMetadataRequest(
|
||||||
rating_key=rating_key,
|
rating_key=rating_key,
|
||||||
)
|
)
|
||||||
@@ -446,7 +617,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetMetadataResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetMetadataResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -475,6 +666,7 @@ class Library:
|
|||||||
r"""Get Items Children
|
r"""Get Items Children
|
||||||
This endpoint will return the children of of a library item specified with the ratingKey.
|
This endpoint will return the children of of a library item specified with the ratingKey.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getMetadataChildren', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetMetadataChildrenRequest(
|
request = operations.GetMetadataChildrenRequest(
|
||||||
rating_key=rating_key,
|
rating_key=rating_key,
|
||||||
)
|
)
|
||||||
@@ -491,7 +683,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetMetadataChildrenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetMetadataChildrenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -520,6 +732,7 @@ class Library:
|
|||||||
r"""Get On Deck
|
r"""Get On Deck
|
||||||
This endpoint will return the on deck content.
|
This endpoint will return the on deck content.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getOnDeck', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/library/onDeck'
|
url = base_url + '/library/onDeck'
|
||||||
@@ -532,7 +745,27 @@ class Library:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetOnDeckResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetOnDeckResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
|
|
||||||
class Log:
|
class Log:
|
||||||
@@ -17,6 +19,7 @@ class Log:
|
|||||||
r"""Logging a single line message.
|
r"""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.
|
This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='logLine', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.LogLineRequest(
|
request = operations.LogLineRequest(
|
||||||
level=level,
|
level=level,
|
||||||
message=message,
|
message=message,
|
||||||
@@ -36,7 +39,27 @@ class Log:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.LogLineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.LogLineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -81,12 +104,13 @@ class Log:
|
|||||||
|
|
||||||
Ensure each parameter is properly URL-encoded to avoid interpretation issues.
|
Ensure each parameter is properly URL-encoded to avoid interpretation issues.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='logMultiLine', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/log'
|
url = base_url + '/log'
|
||||||
headers = {}
|
headers = {}
|
||||||
req_content_type, data, form = utils.serialize_request_body(request, str, "request", False, False, 'string')
|
req_content_type, data, form = utils.serialize_request_body(request, str, "request", False, False, 'string')
|
||||||
if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
|
if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
|
||||||
headers['content-type'] = req_content_type
|
headers['content-type'] = req_content_type
|
||||||
if data is None and form is None:
|
if data is None and form is None:
|
||||||
raise Exception('request body is required')
|
raise Exception('request body is required')
|
||||||
@@ -98,7 +122,27 @@ class Log:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('POST', url, data=data, files=form, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('POST', url, data=data, files=form, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.LogMultiLineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.LogMultiLineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -123,6 +167,7 @@ class Log:
|
|||||||
r"""Enabling Papertrail
|
r"""Enabling Papertrail
|
||||||
This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
|
This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='enablePaperTrail', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/log/networked'
|
url = base_url + '/log/networked'
|
||||||
@@ -135,7 +180,27 @@ class Log:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','403','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.EnablePaperTrailResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.EnablePaperTrailResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
|
|
||||||
class Media:
|
class Media:
|
||||||
@@ -17,6 +19,7 @@ class Media:
|
|||||||
r"""Mark Media Played
|
r"""Mark Media Played
|
||||||
This will mark the provided media key as Played.
|
This will mark the provided media key as Played.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='markPlayed', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.MarkPlayedRequest(
|
request = operations.MarkPlayedRequest(
|
||||||
key=key,
|
key=key,
|
||||||
)
|
)
|
||||||
@@ -34,7 +37,27 @@ class Media:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.MarkPlayedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.MarkPlayedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -59,6 +82,7 @@ class Media:
|
|||||||
r"""Mark Media Unplayed
|
r"""Mark Media Unplayed
|
||||||
This will mark the provided media key as Unplayed.
|
This will mark the provided media key as Unplayed.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='markUnplayed', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.MarkUnplayedRequest(
|
request = operations.MarkUnplayedRequest(
|
||||||
key=key,
|
key=key,
|
||||||
)
|
)
|
||||||
@@ -76,7 +100,27 @@ class Media:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.MarkUnplayedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.MarkUnplayedResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -101,6 +145,7 @@ class Media:
|
|||||||
r"""Update Media Play Progress
|
r"""Update Media Play Progress
|
||||||
This API command can be used to update the play progress of a media item.
|
This API command can be used to update the play progress of a media item.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='updatePlayProgress', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.UpdatePlayProgressRequest(
|
request = operations.UpdatePlayProgressRequest(
|
||||||
key=key,
|
key=key,
|
||||||
time=time,
|
time=time,
|
||||||
@@ -120,7 +165,27 @@ class Media:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('POST', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.UpdatePlayProgressResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.UpdatePlayProgressResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@ class Playlists:
|
|||||||
- `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`).
|
- `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`).
|
||||||
- `playQueueID` - To create a playlist from an existing play queue.
|
- `playQueueID` - To create a playlist from an existing play queue.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='createPlaylist', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/playlists'
|
url = base_url + '/playlists'
|
||||||
@@ -37,7 +40,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('POST', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.CreatePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.CreatePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -66,6 +89,7 @@ class Playlists:
|
|||||||
r"""Get All Playlists
|
r"""Get All Playlists
|
||||||
Get All Playlists given the specified filters.
|
Get All Playlists given the specified filters.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getPlaylists', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetPlaylistsRequest(
|
request = operations.GetPlaylistsRequest(
|
||||||
playlist_type=playlist_type,
|
playlist_type=playlist_type,
|
||||||
smart=smart,
|
smart=smart,
|
||||||
@@ -84,7 +108,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetPlaylistsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetPlaylistsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -114,6 +158,7 @@ class Playlists:
|
|||||||
Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item:
|
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.
|
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.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getPlaylist', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetPlaylistRequest(
|
request = operations.GetPlaylistRequest(
|
||||||
playlist_id=playlist_id,
|
playlist_id=playlist_id,
|
||||||
)
|
)
|
||||||
@@ -130,7 +175,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetPlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetPlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -159,6 +224,7 @@ class Playlists:
|
|||||||
r"""Deletes a Playlist
|
r"""Deletes a Playlist
|
||||||
This endpoint will delete a playlist
|
This endpoint will delete a playlist
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='deletePlaylist', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.DeletePlaylistRequest(
|
request = operations.DeletePlaylistRequest(
|
||||||
playlist_id=playlist_id,
|
playlist_id=playlist_id,
|
||||||
)
|
)
|
||||||
@@ -175,7 +241,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('DELETE', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('DELETE', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.DeletePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.DeletePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -200,6 +286,7 @@ class Playlists:
|
|||||||
r"""Update a Playlist
|
r"""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}`
|
From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='updatePlaylist', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.UpdatePlaylistRequest(
|
request = operations.UpdatePlaylistRequest(
|
||||||
playlist_id=playlist_id,
|
playlist_id=playlist_id,
|
||||||
title=title,
|
title=title,
|
||||||
@@ -219,7 +306,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('PUT', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.UpdatePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.UpdatePlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -247,6 +354,7 @@ class Playlists:
|
|||||||
For example, you could use this to display a list of recently added albums vis a smart playlist.
|
For example, you could use this to display a list of recently added albums vis a smart playlist.
|
||||||
Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.
|
Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getPlaylistContents', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetPlaylistContentsRequest(
|
request = operations.GetPlaylistContentsRequest(
|
||||||
playlist_id=playlist_id,
|
playlist_id=playlist_id,
|
||||||
type=type_,
|
type=type_,
|
||||||
@@ -265,7 +373,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -294,6 +422,7 @@ class Playlists:
|
|||||||
r"""Delete Playlist Contents
|
r"""Delete Playlist Contents
|
||||||
Clears a playlist, only works with dumb playlists. Returns the playlist.
|
Clears a playlist, only works with dumb playlists. Returns the playlist.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='clearPlaylistContents', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.ClearPlaylistContentsRequest(
|
request = operations.ClearPlaylistContentsRequest(
|
||||||
playlist_id=playlist_id,
|
playlist_id=playlist_id,
|
||||||
)
|
)
|
||||||
@@ -310,7 +439,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('DELETE', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('DELETE', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.ClearPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.ClearPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -336,6 +485,7 @@ class Playlists:
|
|||||||
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.
|
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.
|
With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='addPlaylistContents', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.AddPlaylistContentsRequest(
|
request = operations.AddPlaylistContentsRequest(
|
||||||
playlist_id=playlist_id,
|
playlist_id=playlist_id,
|
||||||
uri=uri,
|
uri=uri,
|
||||||
@@ -355,7 +505,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('PUT', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.AddPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.AddPlaylistContentsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -384,6 +554,7 @@ class Playlists:
|
|||||||
r"""Upload Playlist
|
r"""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.
|
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.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='uploadPlaylist', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.UploadPlaylistRequest(
|
request = operations.UploadPlaylistRequest(
|
||||||
path=path,
|
path=path,
|
||||||
force=force,
|
force=force,
|
||||||
@@ -402,7 +573,27 @@ class Playlists:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('POST', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.UploadPlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.UploadPlaylistResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ class Plex:
|
|||||||
r"""Get a Pin
|
r"""Get a Pin
|
||||||
Retrieve a Pin from Plex.tv for authentication flows
|
Retrieve a Pin from Plex.tv for authentication flows
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getPin', oauth2_scopes=[], security_source=None)
|
||||||
request = operations.GetPinRequest(
|
request = operations.GetPinRequest(
|
||||||
x_plex_client_identifier=x_plex_client_identifier,
|
x_plex_client_identifier=x_plex_client_identifier,
|
||||||
strong=strong,
|
strong=strong,
|
||||||
@@ -36,7 +39,27 @@ class Plex:
|
|||||||
|
|
||||||
client = self.sdk_configuration.client
|
client = self.sdk_configuration.client
|
||||||
|
|
||||||
http_res = client.request('POST', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetPinResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetPinResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -65,6 +88,7 @@ class Plex:
|
|||||||
r"""Get Access Token
|
r"""Get Access Token
|
||||||
Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
|
Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getToken', oauth2_scopes=[], security_source=None)
|
||||||
request = operations.GetTokenRequest(
|
request = operations.GetTokenRequest(
|
||||||
pin_id=pin_id,
|
pin_id=pin_id,
|
||||||
x_plex_client_identifier=x_plex_client_identifier,
|
x_plex_client_identifier=x_plex_client_identifier,
|
||||||
@@ -82,7 +106,27 @@ class Plex:
|
|||||||
|
|
||||||
client = self.sdk_configuration.client
|
client = self.sdk_configuration.client
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetTokenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetTokenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from .statistics import Statistics
|
|||||||
from .updater import Updater
|
from .updater import Updater
|
||||||
from .video import Video
|
from .video import Video
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import SDKHooks
|
||||||
from plex_api.models import components
|
from plex_api.models import components
|
||||||
from typing import Callable, Dict, Union
|
from typing import Callable, Dict, Union
|
||||||
|
|
||||||
@@ -124,6 +125,16 @@ class PlexAPI:
|
|||||||
]
|
]
|
||||||
|
|
||||||
self.sdk_configuration = SDKConfiguration(client, security, server_url, server_idx, server_defaults, retry_config=retry_config)
|
self.sdk_configuration = SDKConfiguration(client, security, server_url, server_idx, server_defaults, retry_config=retry_config)
|
||||||
|
|
||||||
|
hooks = SDKHooks()
|
||||||
|
|
||||||
|
current_server_url, *_ = self.sdk_configuration.get_server_details()
|
||||||
|
server_url, self.sdk_configuration.client = hooks.sdk_init(current_server_url, self.sdk_configuration.client)
|
||||||
|
if current_server_url != server_url:
|
||||||
|
self.sdk_configuration.server_url = server_url
|
||||||
|
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
self.sdk_configuration._hooks=hooks
|
||||||
|
|
||||||
self._init_sdks()
|
self._init_sdks()
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import requests as requests_http
|
import requests as requests_http
|
||||||
|
from ._hooks import SDKHooks
|
||||||
from .utils import utils
|
from .utils import utils
|
||||||
from .utils.retries import RetryConfig
|
from .utils.retries import RetryConfig
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
@@ -31,10 +32,11 @@ class SDKConfiguration:
|
|||||||
server_defaults: List[Dict[str, str]] = field(default_factory=List)
|
server_defaults: List[Dict[str, str]] = field(default_factory=List)
|
||||||
language: str = 'python'
|
language: str = 'python'
|
||||||
openapi_doc_version: str = '0.0.3'
|
openapi_doc_version: str = '0.0.3'
|
||||||
sdk_version: str = '0.2.1'
|
sdk_version: str = '0.3.0'
|
||||||
gen_version: str = '2.272.4'
|
gen_version: str = '2.275.4'
|
||||||
user_agent: str = 'speakeasy-sdk/python 0.2.1 2.272.4 0.0.3 plex-api-client'
|
user_agent: str = 'speakeasy-sdk/python 0.3.0 2.275.4 0.0.3 plex-api-client'
|
||||||
retry_config: RetryConfig = None
|
retry_config: RetryConfig = None
|
||||||
|
_hooks: SDKHooks = None
|
||||||
|
|
||||||
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
|
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
|
||||||
if self.server_url:
|
if self.server_url:
|
||||||
@@ -43,3 +45,7 @@ class SDKConfiguration:
|
|||||||
self.server_idx = 0
|
self.server_idx = 0
|
||||||
|
|
||||||
return SERVERS[self.server_idx], self.server_defaults[self.server_idx]
|
return SERVERS[self.server_idx], self.server_defaults[self.server_idx]
|
||||||
|
|
||||||
|
|
||||||
|
def get_hooks(self) -> SDKHooks:
|
||||||
|
return self._hooks
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ class Search:
|
|||||||
|
|
||||||
This request is intended to be very fast, and called as the user types.
|
This request is intended to be very fast, and called as the user types.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='performSearch', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.PerformSearchRequest(
|
request = operations.PerformSearchRequest(
|
||||||
query=query,
|
query=query,
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
@@ -48,7 +51,27 @@ class Search:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.PerformSearchResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.PerformSearchResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -76,6 +99,7 @@ class Search:
|
|||||||
Whenever possible, clients should limit the search to the appropriate type.
|
Whenever possible, clients should limit the search to the appropriate type.
|
||||||
Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
|
Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='performVoiceSearch', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.PerformVoiceSearchRequest(
|
request = operations.PerformVoiceSearchRequest(
|
||||||
query=query,
|
query=query,
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
@@ -95,7 +119,27 @@ class Search:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.PerformVoiceSearchResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.PerformVoiceSearchResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -120,6 +164,7 @@ class Search:
|
|||||||
r"""Get Search Results
|
r"""Get Search Results
|
||||||
This will search the database for the string provided.
|
This will search the database for the string provided.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getSearchResults', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetSearchResultsRequest(
|
request = operations.GetSearchResultsRequest(
|
||||||
query=query,
|
query=query,
|
||||||
)
|
)
|
||||||
@@ -137,7 +182,27 @@ class Search:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetSearchResultsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetSearchResultsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ class Server:
|
|||||||
r"""Server Capabilities
|
r"""Server Capabilities
|
||||||
Server Capabilities
|
Server Capabilities
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getServerCapabilities', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/'
|
url = base_url + '/'
|
||||||
@@ -30,7 +33,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetServerCapabilitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetServerCapabilitiesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -59,6 +82,7 @@ class Server:
|
|||||||
r"""Get Server Preferences
|
r"""Get Server Preferences
|
||||||
Get Server Preferences
|
Get Server Preferences
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getServerPreferences', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/:/prefs'
|
url = base_url + '/:/prefs'
|
||||||
@@ -71,7 +95,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetServerPreferencesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetServerPreferencesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -100,6 +144,7 @@ class Server:
|
|||||||
r"""Get Available Clients
|
r"""Get Available Clients
|
||||||
Get Available Clients
|
Get Available Clients
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getAvailableClients', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/clients'
|
url = base_url + '/clients'
|
||||||
@@ -112,7 +157,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetAvailableClientsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetAvailableClientsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -141,6 +206,7 @@ class Server:
|
|||||||
r"""Get Devices
|
r"""Get Devices
|
||||||
Get Devices
|
Get Devices
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getDevices', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/devices'
|
url = base_url + '/devices'
|
||||||
@@ -153,7 +219,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetDevicesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetDevicesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -182,6 +268,7 @@ class Server:
|
|||||||
r"""Get Server Identity
|
r"""Get Server Identity
|
||||||
Get Server Identity
|
Get Server Identity
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getServerIdentity', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/identity'
|
url = base_url + '/identity'
|
||||||
@@ -194,7 +281,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetServerIdentityResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetServerIdentityResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -223,6 +330,7 @@ class Server:
|
|||||||
r"""Get MyPlex Account
|
r"""Get MyPlex Account
|
||||||
Returns MyPlex Account Information
|
Returns MyPlex Account Information
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getMyPlexAccount', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/myplex/account'
|
url = base_url + '/myplex/account'
|
||||||
@@ -235,7 +343,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetMyPlexAccountResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetMyPlexAccountResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -264,6 +392,7 @@ class Server:
|
|||||||
r"""Get a Resized Photo
|
r"""Get a Resized Photo
|
||||||
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
|
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getResizedPhoto', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/photo/:/transcode'
|
url = base_url + '/photo/:/transcode'
|
||||||
@@ -277,7 +406,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetResizedPhotoResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetResizedPhotoResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -302,6 +451,7 @@ class Server:
|
|||||||
r"""Get Server List
|
r"""Get Server List
|
||||||
Get Server List
|
Get Server List
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getServerList', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/servers'
|
url = base_url + '/servers'
|
||||||
@@ -314,7 +464,27 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetServerListResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetServerListResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ class Sessions:
|
|||||||
r"""Get Active Sessions
|
r"""Get Active Sessions
|
||||||
This will retrieve the \"Now Playing\" Information of the PMS.
|
This will retrieve the \"Now Playing\" Information of the PMS.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getSessions', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/status/sessions'
|
url = base_url + '/status/sessions'
|
||||||
@@ -30,7 +33,27 @@ class Sessions:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetSessionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetSessionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -59,6 +82,7 @@ class Sessions:
|
|||||||
r"""Get Session History
|
r"""Get Session History
|
||||||
This will Retrieve a listing of all history views.
|
This will Retrieve a listing of all history views.
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getSessionHistory', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/status/sessions/history/all'
|
url = base_url + '/status/sessions/history/all'
|
||||||
@@ -71,7 +95,27 @@ class Sessions:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetSessionHistoryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetSessionHistoryResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -100,6 +144,7 @@ class Sessions:
|
|||||||
r"""Get Transcode Sessions
|
r"""Get Transcode Sessions
|
||||||
Get Transcode Sessions
|
Get Transcode Sessions
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getTranscodeSessions', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/transcode/sessions'
|
url = base_url + '/transcode/sessions'
|
||||||
@@ -112,7 +157,27 @@ class Sessions:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetTranscodeSessionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetTranscodeSessionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -141,6 +206,7 @@ class Sessions:
|
|||||||
r"""Stop a Transcode Session
|
r"""Stop a Transcode Session
|
||||||
Stop a Transcode Session
|
Stop a Transcode Session
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='stopTranscodeSession', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.StopTranscodeSessionRequest(
|
request = operations.StopTranscodeSessionRequest(
|
||||||
session_key=session_key,
|
session_key=session_key,
|
||||||
)
|
)
|
||||||
@@ -157,7 +223,27 @@ class Sessions:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('DELETE', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('DELETE', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.StopTranscodeSessionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.StopTranscodeSessionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@ class Statistics:
|
|||||||
r"""Get Media Statistics
|
r"""Get Media Statistics
|
||||||
This will return the media statistics for the server
|
This will return the media statistics for the server
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getStatistics', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.GetStatisticsRequest(
|
request = operations.GetStatisticsRequest(
|
||||||
timespan=timespan,
|
timespan=timespan,
|
||||||
)
|
)
|
||||||
@@ -35,7 +38,27 @@ class Statistics:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetStatisticsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetStatisticsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ class Updater:
|
|||||||
r"""Querying status of updates
|
r"""Querying status of updates
|
||||||
Querying status of updates
|
Querying status of updates
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getUpdateStatus', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/updater/status'
|
url = base_url + '/updater/status'
|
||||||
@@ -32,7 +35,27 @@ class Updater:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetUpdateStatusResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetUpdateStatusResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -61,6 +84,7 @@ class Updater:
|
|||||||
r"""Checking for updates
|
r"""Checking for updates
|
||||||
Checking for updates
|
Checking for updates
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='checkForUpdates', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.CheckForUpdatesRequest(
|
request = operations.CheckForUpdatesRequest(
|
||||||
download=download,
|
download=download,
|
||||||
)
|
)
|
||||||
@@ -78,7 +102,27 @@ class Updater:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('PUT', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.CheckForUpdatesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.CheckForUpdatesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -103,6 +147,7 @@ class Updater:
|
|||||||
r"""Apply Updates
|
r"""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
|
Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='applyUpdates', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
request = operations.ApplyUpdatesRequest(
|
request = operations.ApplyUpdatesRequest(
|
||||||
tonight=tonight,
|
tonight=tonight,
|
||||||
skip=skip,
|
skip=skip,
|
||||||
@@ -121,7 +166,27 @@ class Updater:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('PUT', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','500','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.ApplyUpdatesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.ApplyUpdatesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
@@ -21,15 +21,16 @@ from dataclasses_json import DataClassJsonMixin
|
|||||||
class SecurityClient:
|
class SecurityClient:
|
||||||
client: requests.Session
|
client: requests.Session
|
||||||
query_params: Dict[str, str] = {}
|
query_params: Dict[str, str] = {}
|
||||||
|
headers: Dict[str, str] = {}
|
||||||
|
|
||||||
def __init__(self, client: requests.Session):
|
def __init__(self, client: requests.Session):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
def request(self, method, url, **kwargs):
|
def send(self, request: requests.PreparedRequest, **kwargs):
|
||||||
params = kwargs.get('params', {})
|
request.prepare_url(url=request.url, params=self.query_params)
|
||||||
kwargs["params"] = {**self.query_params, **params}
|
request.headers.update(self.headers)
|
||||||
|
|
||||||
return self.client.request(method, url, **kwargs)
|
return self.client.send(request, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def configure_security_client(client: requests.Session, security: dataclass):
|
def configure_security_client(client: requests.Session, security: dataclass):
|
||||||
@@ -102,20 +103,19 @@ def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: Dict,
|
|||||||
|
|
||||||
if scheme_type == "apiKey":
|
if scheme_type == "apiKey":
|
||||||
if sub_type == 'header':
|
if sub_type == 'header':
|
||||||
client.client.headers[header_name] = value
|
client.headers[header_name] = value
|
||||||
elif sub_type == 'query':
|
elif sub_type == 'query':
|
||||||
client.query_params[header_name] = value
|
client.query_params[header_name] = value
|
||||||
elif sub_type == 'cookie':
|
|
||||||
client.client.cookies[header_name] = value
|
|
||||||
else:
|
else:
|
||||||
raise Exception('not supported')
|
raise Exception('not supported')
|
||||||
elif scheme_type == "openIdConnect":
|
elif scheme_type == "openIdConnect":
|
||||||
client.client.headers[header_name] = _apply_bearer(value)
|
client.headers[header_name] = _apply_bearer(value)
|
||||||
elif scheme_type == 'oauth2':
|
elif scheme_type == 'oauth2':
|
||||||
client.client.headers[header_name] = _apply_bearer(value)
|
if sub_type != 'client_credentials':
|
||||||
|
client.headers[header_name] = _apply_bearer(value)
|
||||||
elif scheme_type == 'http':
|
elif scheme_type == 'http':
|
||||||
if sub_type == 'bearer':
|
if sub_type == 'bearer':
|
||||||
client.client.headers[header_name] = _apply_bearer(value)
|
client.headers[header_name] = _apply_bearer(value)
|
||||||
else:
|
else:
|
||||||
raise Exception('not supported')
|
raise Exception('not supported')
|
||||||
else:
|
else:
|
||||||
@@ -145,7 +145,7 @@ def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass):
|
|||||||
password = value
|
password = value
|
||||||
|
|
||||||
data = f'{username}:{password}'.encode()
|
data = f'{username}:{password}'.encode()
|
||||||
client.client.headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}'
|
client.headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}'
|
||||||
|
|
||||||
|
|
||||||
def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass,
|
def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass,
|
||||||
@@ -264,7 +264,8 @@ def get_query_params(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[
|
|||||||
f_name = metadata.get("field_name")
|
f_name = metadata.get("field_name")
|
||||||
serialization = metadata.get('serialization', '')
|
serialization = metadata.get('serialization', '')
|
||||||
if serialization != '':
|
if serialization != '':
|
||||||
serialized_parms = _get_serialized_params(metadata, field.type, f_name, value)
|
serialized_parms = _get_serialized_params(
|
||||||
|
metadata, field.type, f_name, value)
|
||||||
for key, value in serialized_parms.items():
|
for key, value in serialized_parms.items():
|
||||||
if key in params:
|
if key in params:
|
||||||
params[key].extend(value)
|
params[key].extend(value)
|
||||||
@@ -312,7 +313,8 @@ def _get_serialized_params(metadata: Dict, field_type: type, field_name: str, ob
|
|||||||
|
|
||||||
serialization = metadata.get('serialization', '')
|
serialization = metadata.get('serialization', '')
|
||||||
if serialization == 'json':
|
if serialization == 'json':
|
||||||
params[metadata.get("field_name", field_name)] = marshal_json(obj, field_type)
|
params[metadata.get("field_name", field_name)
|
||||||
|
] = marshal_json(obj, field_type)
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
@@ -702,7 +704,8 @@ def unmarshal_json(data, typ, decoder=None):
|
|||||||
|
|
||||||
def marshal_json(val, typ, encoder=None):
|
def marshal_json(val, typ, encoder=None):
|
||||||
if not is_optional_type(typ) and val is None:
|
if not is_optional_type(typ) and val is None:
|
||||||
raise ValueError(f"Could not marshal None into non-optional type: {typ}")
|
raise ValueError(
|
||||||
|
f"Could not marshal None into non-optional type: {typ}")
|
||||||
|
|
||||||
marshal = make_dataclass('Marshal', [('res', typ)],
|
marshal = make_dataclass('Marshal', [('res', typ)],
|
||||||
bases=(DataClassJsonMixin,))
|
bases=(DataClassJsonMixin,))
|
||||||
@@ -732,6 +735,16 @@ def match_content_type(content_type: str, pattern: str) -> boolean:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def match_status_codes(status_codes: List[str], status_code: int) -> bool:
|
||||||
|
for code in status_codes:
|
||||||
|
if code == str(status_code):
|
||||||
|
return True
|
||||||
|
|
||||||
|
if code.endswith("XX") and code.startswith(str(status_code)[:1]):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def datetimeisoformat(optional: bool):
|
def datetimeisoformat(optional: bool):
|
||||||
def isoformatoptional(val):
|
def isoformatoptional(val):
|
||||||
if optional and val is None:
|
if optional and val is None:
|
||||||
@@ -835,6 +848,7 @@ def list_decoder(value_decoder: Callable):
|
|||||||
|
|
||||||
return list_decode
|
return list_decode
|
||||||
|
|
||||||
|
|
||||||
def union_encoder(all_encoders: Dict[str, Callable]):
|
def union_encoder(all_encoders: Dict[str, Callable]):
|
||||||
def selective_encoder(val: any):
|
def selective_encoder(val: any):
|
||||||
if type(val) in all_encoders:
|
if type(val) in all_encoders:
|
||||||
@@ -842,6 +856,7 @@ def union_encoder(all_encoders: Dict[str, Callable]):
|
|||||||
return val
|
return val
|
||||||
return selective_encoder
|
return selective_encoder
|
||||||
|
|
||||||
|
|
||||||
def union_decoder(all_decoders: List[Callable]):
|
def union_decoder(all_decoders: List[Callable]):
|
||||||
def selective_decoder(val: any):
|
def selective_decoder(val: any):
|
||||||
decoded = val
|
decoded = val
|
||||||
@@ -854,6 +869,7 @@ def union_decoder(all_decoders: List[Callable]):
|
|||||||
return decoded
|
return decoded
|
||||||
return selective_decoder
|
return selective_decoder
|
||||||
|
|
||||||
|
|
||||||
def get_field_name(name):
|
def get_field_name(name):
|
||||||
def override(_, _field_name=name):
|
def override(_, _field_name=name):
|
||||||
return _field_name
|
return _field_name
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
|
||||||
|
|
||||||
|
import requests as requests_http
|
||||||
from .sdkconfiguration import SDKConfiguration
|
from .sdkconfiguration import SDKConfiguration
|
||||||
from plex_api import utils
|
from plex_api import utils
|
||||||
|
from plex_api._hooks import HookContext
|
||||||
from plex_api.models import errors, operations
|
from plex_api.models import errors, operations
|
||||||
|
|
||||||
class Video:
|
class Video:
|
||||||
@@ -17,6 +19,7 @@ class Video:
|
|||||||
r"""Get the timeline for a media item
|
r"""Get the timeline for a media item
|
||||||
Get the timeline for a media item
|
Get the timeline for a media item
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='getTimeline', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/:/timeline'
|
url = base_url + '/:/timeline'
|
||||||
@@ -30,7 +33,27 @@ class Video:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.GetTimelineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.GetTimelineResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
@@ -55,6 +78,7 @@ class Video:
|
|||||||
r"""Start Universal Transcode
|
r"""Start Universal Transcode
|
||||||
Begin a Universal Transcode Session
|
Begin a Universal Transcode Session
|
||||||
"""
|
"""
|
||||||
|
hook_ctx = HookContext(operation_id='startUniversalTranscode', oauth2_scopes=[], security_source=self.sdk_configuration.security)
|
||||||
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
|
||||||
|
|
||||||
url = base_url + '/video/:/transcode/universal/start.mpd'
|
url = base_url + '/video/:/transcode/universal/start.mpd'
|
||||||
@@ -68,7 +92,27 @@ class Video:
|
|||||||
else:
|
else:
|
||||||
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
|
||||||
|
|
||||||
http_res = client.request('GET', url, params=query_params, headers=headers)
|
|
||||||
|
try:
|
||||||
|
req = self.sdk_configuration.get_hooks().before_request(
|
||||||
|
hook_ctx,
|
||||||
|
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||||
|
)
|
||||||
|
http_res = client.send(req)
|
||||||
|
except Exception as e:
|
||||||
|
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||||
|
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||||
|
if e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
raise result
|
||||||
|
http_res = result
|
||||||
|
|
||||||
content_type = http_res.headers.get('Content-Type')
|
content_type = http_res.headers.get('Content-Type')
|
||||||
|
|
||||||
res = operations.StartUniversalTranscodeResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
res = operations.StartUniversalTranscodeResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
|
||||||
|
|||||||
Reference in New Issue
Block a user