diff --git a/nuon/api/apps/get_app_config_graph_v2.py b/nuon/api/apps/get_app_config_graph_v2.py index f14b3b94..7607457a 100644 --- a/nuon/api/apps/get_app_config_graph_v2.py +++ b/nuon/api/apps/get_app_config_graph_v2.py @@ -11,11 +11,11 @@ def _get_kwargs( app_id: str, - app_config_id: str, + config_id: str, ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/v1/apps/{app_id}/configs/{app_config_id}/graph", + "url": f"/v1/apps/{app_id}/configs/{config_id}/graph", } return _kwargs @@ -72,7 +72,7 @@ def _build_response( def sync_detailed( app_id: str, - app_config_id: str, + config_id: str, *, client: AuthenticatedClient, ) -> Response[StderrErrResponse | str]: @@ -85,7 +85,7 @@ def sync_detailed( Args: app_id (str): - app_config_id (str): + config_id (str): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -97,7 +97,7 @@ def sync_detailed( kwargs = _get_kwargs( app_id=app_id, - app_config_id=app_config_id, + config_id=config_id, ) response = client.get_httpx_client().request( @@ -109,7 +109,7 @@ def sync_detailed( def sync( app_id: str, - app_config_id: str, + config_id: str, *, client: AuthenticatedClient, ) -> StderrErrResponse | str | None: @@ -122,7 +122,7 @@ def sync( Args: app_id (str): - app_config_id (str): + config_id (str): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -134,14 +134,14 @@ def sync( return sync_detailed( app_id=app_id, - app_config_id=app_config_id, + config_id=config_id, client=client, ).parsed async def asyncio_detailed( app_id: str, - app_config_id: str, + config_id: str, *, client: AuthenticatedClient, ) -> Response[StderrErrResponse | str]: @@ -154,7 +154,7 @@ async def asyncio_detailed( Args: app_id (str): - app_config_id (str): + config_id (str): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -166,7 +166,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( app_id=app_id, - app_config_id=app_config_id, + config_id=config_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -176,7 +176,7 @@ async def asyncio_detailed( async def asyncio( app_id: str, - app_config_id: str, + config_id: str, *, client: AuthenticatedClient, ) -> StderrErrResponse | str | None: @@ -189,7 +189,7 @@ async def asyncio( Args: app_id (str): - app_config_id (str): + config_id (str): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -202,7 +202,7 @@ async def asyncio( return ( await asyncio_detailed( app_id=app_id, - app_config_id=app_config_id, + config_id=config_id, client=client, ) ).parsed diff --git a/nuon/api/apps/get_app_conflg_v2.py b/nuon/api/apps/get_app_conflg_v2.py new file mode 100644 index 00000000..9b0331d8 --- /dev/null +++ b/nuon/api/apps/get_app_conflg_v2.py @@ -0,0 +1,219 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_app_config import AppAppConfig +from ...models.stderr_err_response import StderrErrResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + app_id: str, + config_id: str, + *, + recurse: bool | Unset = False, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["recurse"] = recurse + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/v1/apps/{app_id}/configs/{config_id}", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AppAppConfig | StderrErrResponse | None: + if response.status_code == 200: + response_200 = AppAppConfig.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = StderrErrResponse.from_dict(response.json()) + + return response_400 + + if response.status_code == 401: + response_401 = StderrErrResponse.from_dict(response.json()) + + return response_401 + + if response.status_code == 403: + response_403 = StderrErrResponse.from_dict(response.json()) + + return response_403 + + if response.status_code == 404: + response_404 = StderrErrResponse.from_dict(response.json()) + + return response_404 + + if response.status_code == 500: + response_500 = StderrErrResponse.from_dict(response.json()) + + return response_500 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AppAppConfig | StderrErrResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + config_id: str, + *, + client: AuthenticatedClient, + recurse: bool | Unset = False, +) -> Response[AppAppConfig | StderrErrResponse]: + """get an app config + + Fetch an app config by id. + + Args: + app_id (str): + config_id (str): + recurse (bool | Unset): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AppAppConfig | StderrErrResponse] + """ + + kwargs = _get_kwargs( + app_id=app_id, + config_id=config_id, + recurse=recurse, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + config_id: str, + *, + client: AuthenticatedClient, + recurse: bool | Unset = False, +) -> AppAppConfig | StderrErrResponse | None: + """get an app config + + Fetch an app config by id. + + Args: + app_id (str): + config_id (str): + recurse (bool | Unset): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AppAppConfig | StderrErrResponse + """ + + return sync_detailed( + app_id=app_id, + config_id=config_id, + client=client, + recurse=recurse, + ).parsed + + +async def asyncio_detailed( + app_id: str, + config_id: str, + *, + client: AuthenticatedClient, + recurse: bool | Unset = False, +) -> Response[AppAppConfig | StderrErrResponse]: + """get an app config + + Fetch an app config by id. + + Args: + app_id (str): + config_id (str): + recurse (bool | Unset): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AppAppConfig | StderrErrResponse] + """ + + kwargs = _get_kwargs( + app_id=app_id, + config_id=config_id, + recurse=recurse, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + config_id: str, + *, + client: AuthenticatedClient, + recurse: bool | Unset = False, +) -> AppAppConfig | StderrErrResponse | None: + """get an app config + + Fetch an app config by id. + + Args: + app_id (str): + config_id (str): + recurse (bool | Unset): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AppAppConfig | StderrErrResponse + """ + + return ( + await asyncio_detailed( + app_id=app_id, + config_id=config_id, + client=client, + recurse=recurse, + ) + ).parsed diff --git a/nuon/api/apps/update_app_config_installs_v2.py b/nuon/api/apps/update_app_config_installs_v2.py index d7d0ae41..49ba75c7 100644 --- a/nuon/api/apps/update_app_config_installs_v2.py +++ b/nuon/api/apps/update_app_config_installs_v2.py @@ -20,7 +20,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": f"/v1/apps/{app_id}/config/{config_id}/update-installs", + "url": f"/v1/apps/{app_id}/configs/{config_id}/update-installs", } _kwargs["json"] = body.to_dict() diff --git a/nuon/api/apps/update_app_conflg_v2.py b/nuon/api/apps/update_app_conflg_v2.py index 71a4a81b..b819509f 100644 --- a/nuon/api/apps/update_app_conflg_v2.py +++ b/nuon/api/apps/update_app_conflg_v2.py @@ -21,7 +21,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "patch", - "url": f"/v1/apps/{app_id}/config/{config_id}", + "url": f"/v1/apps/{app_id}/configs/{config_id}", } _kwargs["json"] = body.to_dict() diff --git a/pyproject.toml b/pyproject.toml index 3a43f465..398bae3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nuon" -version = "0.19.705" +version = "0.19.707" description = "A client library for accessing Nuon" authors = [] requires-python = ">=3.10" diff --git a/version.txt b/version.txt index 054c7ef9..a64fd3de 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.19.705 +0.19.707