Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2022-02-27 21:34:21 -08:00
parent 0b9c32e6bf
commit 9c18ba2350
13 changed files with 205 additions and 183 deletions

View File

@ -4,6 +4,7 @@ import httpx
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.error_message import ErrorMessage
from ...types import Response
def _get_kwargs(
@ -23,23 +24,23 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
if response.status_code == 200:
response_200 = FileConversion.from_dict(response.json())
return response_200
if response.status_code == 401:
response_401 = None
response_401 = ErrorMessage.from_dict(response.json())
return response_401
if response.status_code == 403:
response_403 = None
response_403 = ErrorMessage.from_dict(response.json())
return response_403
if response.status_code == 404:
response_404 = None
response_404 = ErrorMessage.from_dict(response.json())
return response_404
return None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion]]:
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, ErrorMessage]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -51,7 +52,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConv
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -67,7 +68,7 @@ def sync_detailed(
def sync(
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """
return sync_detailed(
@ -78,7 +79,7 @@ def sync(
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, FileConversion]]:
) -> Response[Union[Any, FileConversion, ErrorMessage]]:
kwargs = _get_kwargs(
client=client,
)
@ -92,7 +93,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
) -> Optional[Union[Any, FileConversion, ErrorMessage]]:
""" Stop all async conversions that are currently running. This endpoint can only be used by specific KittyCAD employees. """
return (