Regenerated with pythonv2 and newest spec

This commit is contained in:
Luke Hagar
2024-09-09 18:08:47 +00:00
parent 02226c3294
commit 6565d702c6
911 changed files with 49000 additions and 17210 deletions

View File

@@ -0,0 +1,585 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from .basesdk import BaseSDK
from plex_api_client import utils
from plex_api_client._hooks import HookContext
from plex_api_client.models import errors, operations
from plex_api_client.types import OptionalNullable, UNSET
from typing import Any, Optional
class Updater(BaseSDK):
r"""This describes the API for searching and applying updates to the Plex Media Server.
Updates to the status can be observed via the Event API.
"""
def get_update_status(
self,
*,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
) -> operations.GetUpdateStatusResponse:
r"""Querying status of updates
Querying status of updates
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
req = self.build_request(
method="GET",
path="/updater/status",
base_url=base_url,
url_variables=url_variables,
request=None,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
security=self.sdk_configuration.security,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = self.do_request(
hook_ctx=HookContext(
operation_id="getUpdateStatus",
oauth2_scopes=[],
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["400", "401", "4XX", "5XX"],
retry_config=retry_config,
)
data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return operations.GetUpdateStatusResponse(
object=utils.unmarshal_json(
http_res.text, Optional[operations.GetUpdateStatusResponseBody]
),
status_code=http_res.status_code,
content_type=http_res.headers.get("Content-Type") or "",
raw_response=http_res,
)
if utils.match_response(http_res, "400", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.GetUpdateStatusResponseBodyData
)
data.raw_response = http_res
raise errors.GetUpdateStatusResponseBody(data=data)
if utils.match_response(http_res, "401", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.GetUpdateStatusUpdaterResponseBodyData
)
data.raw_response = http_res
raise errors.GetUpdateStatusUpdaterResponseBody(data=data)
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
)
content_type = http_res.headers.get("Content-Type")
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res,
)
async def get_update_status_async(
self,
*,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
) -> operations.GetUpdateStatusResponse:
r"""Querying status of updates
Querying status of updates
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
req = self.build_request_async(
method="GET",
path="/updater/status",
base_url=base_url,
url_variables=url_variables,
request=None,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
security=self.sdk_configuration.security,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
operation_id="getUpdateStatus",
oauth2_scopes=[],
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["400", "401", "4XX", "5XX"],
retry_config=retry_config,
)
data: Any = None
if utils.match_response(http_res, "200", "application/json"):
return operations.GetUpdateStatusResponse(
object=utils.unmarshal_json(
http_res.text, Optional[operations.GetUpdateStatusResponseBody]
),
status_code=http_res.status_code,
content_type=http_res.headers.get("Content-Type") or "",
raw_response=http_res,
)
if utils.match_response(http_res, "400", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.GetUpdateStatusResponseBodyData
)
data.raw_response = http_res
raise errors.GetUpdateStatusResponseBody(data=data)
if utils.match_response(http_res, "401", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.GetUpdateStatusUpdaterResponseBodyData
)
data.raw_response = http_res
raise errors.GetUpdateStatusUpdaterResponseBody(data=data)
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
)
content_type = http_res.headers.get("Content-Type")
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res,
)
def check_for_updates(
self,
*,
download: Optional[operations.Download] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
) -> operations.CheckForUpdatesResponse:
r"""Checking for updates
Checking for updates
:param download: Indicate that you want to start download any updates found.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
request = operations.CheckForUpdatesRequest(
download=download,
)
req = self.build_request(
method="PUT",
path="/updater/check",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
security=self.sdk_configuration.security,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = self.do_request(
hook_ctx=HookContext(
operation_id="checkForUpdates",
oauth2_scopes=[],
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["400", "401", "4XX", "5XX"],
retry_config=retry_config,
)
data: Any = None
if utils.match_response(http_res, "200", "*"):
return operations.CheckForUpdatesResponse(
status_code=http_res.status_code,
content_type=http_res.headers.get("Content-Type") or "",
raw_response=http_res,
)
if utils.match_response(http_res, "400", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.CheckForUpdatesResponseBodyData
)
data.raw_response = http_res
raise errors.CheckForUpdatesResponseBody(data=data)
if utils.match_response(http_res, "401", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.CheckForUpdatesUpdaterResponseBodyData
)
data.raw_response = http_res
raise errors.CheckForUpdatesUpdaterResponseBody(data=data)
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
)
content_type = http_res.headers.get("Content-Type")
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res,
)
async def check_for_updates_async(
self,
*,
download: Optional[operations.Download] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
) -> operations.CheckForUpdatesResponse:
r"""Checking for updates
Checking for updates
:param download: Indicate that you want to start download any updates found.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
request = operations.CheckForUpdatesRequest(
download=download,
)
req = self.build_request_async(
method="PUT",
path="/updater/check",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
security=self.sdk_configuration.security,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
operation_id="checkForUpdates",
oauth2_scopes=[],
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["400", "401", "4XX", "5XX"],
retry_config=retry_config,
)
data: Any = None
if utils.match_response(http_res, "200", "*"):
return operations.CheckForUpdatesResponse(
status_code=http_res.status_code,
content_type=http_res.headers.get("Content-Type") or "",
raw_response=http_res,
)
if utils.match_response(http_res, "400", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.CheckForUpdatesResponseBodyData
)
data.raw_response = http_res
raise errors.CheckForUpdatesResponseBody(data=data)
if utils.match_response(http_res, "401", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.CheckForUpdatesUpdaterResponseBodyData
)
data.raw_response = http_res
raise errors.CheckForUpdatesUpdaterResponseBody(data=data)
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
)
content_type = http_res.headers.get("Content-Type")
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res,
)
def apply_updates(
self,
*,
tonight: Optional[operations.Tonight] = None,
skip: Optional[operations.Skip] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
) -> operations.ApplyUpdatesResponse:
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
:param tonight: Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install
:param skip: Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
request = operations.ApplyUpdatesRequest(
tonight=tonight,
skip=skip,
)
req = self.build_request(
method="PUT",
path="/updater/apply",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
security=self.sdk_configuration.security,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = self.do_request(
hook_ctx=HookContext(
operation_id="applyUpdates",
oauth2_scopes=[],
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["400", "401", "4XX", "500", "5XX"],
retry_config=retry_config,
)
data: Any = None
if utils.match_response(http_res, "200", "*"):
return operations.ApplyUpdatesResponse(
status_code=http_res.status_code,
content_type=http_res.headers.get("Content-Type") or "",
raw_response=http_res,
)
if utils.match_response(http_res, "400", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.ApplyUpdatesResponseBodyData
)
data.raw_response = http_res
raise errors.ApplyUpdatesResponseBody(data=data)
if utils.match_response(http_res, "401", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.ApplyUpdatesUpdaterResponseBodyData
)
data.raw_response = http_res
raise errors.ApplyUpdatesUpdaterResponseBody(data=data)
if utils.match_response(http_res, ["4XX", "500", "5XX"], "*"):
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
)
content_type = http_res.headers.get("Content-Type")
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res,
)
async def apply_updates_async(
self,
*,
tonight: Optional[operations.Tonight] = None,
skip: Optional[operations.Skip] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
) -> operations.ApplyUpdatesResponse:
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
:param tonight: Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install
:param skip: Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
"""
base_url = None
url_variables = None
if timeout_ms is None:
timeout_ms = self.sdk_configuration.timeout_ms
if server_url is not None:
base_url = server_url
request = operations.ApplyUpdatesRequest(
tonight=tonight,
skip=skip,
)
req = self.build_request_async(
method="PUT",
path="/updater/apply",
base_url=base_url,
url_variables=url_variables,
request=request,
request_body_required=False,
request_has_path_params=False,
request_has_query_params=True,
user_agent_header="user-agent",
accept_header_value="application/json",
security=self.sdk_configuration.security,
timeout_ms=timeout_ms,
)
if retries == UNSET:
if self.sdk_configuration.retry_config is not UNSET:
retries = self.sdk_configuration.retry_config
retry_config = None
if isinstance(retries, utils.RetryConfig):
retry_config = (retries, ["429", "500", "502", "503", "504"])
http_res = await self.do_request_async(
hook_ctx=HookContext(
operation_id="applyUpdates",
oauth2_scopes=[],
security_source=self.sdk_configuration.security,
),
request=req,
error_status_codes=["400", "401", "4XX", "500", "5XX"],
retry_config=retry_config,
)
data: Any = None
if utils.match_response(http_res, "200", "*"):
return operations.ApplyUpdatesResponse(
status_code=http_res.status_code,
content_type=http_res.headers.get("Content-Type") or "",
raw_response=http_res,
)
if utils.match_response(http_res, "400", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.ApplyUpdatesResponseBodyData
)
data.raw_response = http_res
raise errors.ApplyUpdatesResponseBody(data=data)
if utils.match_response(http_res, "401", "application/json"):
data = utils.unmarshal_json(
http_res.text, errors.ApplyUpdatesUpdaterResponseBodyData
)
data.raw_response = http_res
raise errors.ApplyUpdatesUpdaterResponseBody(data=data)
if utils.match_response(http_res, ["4XX", "500", "5XX"], "*"):
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
)
content_type = http_res.headers.get("Content-Type")
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res,
)