Updated specs to API version 0.4

This commit is contained in:
Profitroll 2023-06-22 14:46:58 +02:00
parent d643fde917
commit 6d4b848568
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
3 changed files with 33 additions and 23 deletions

View File

@ -1,4 +1,5 @@
from http import HTTPStatus
from io import BytesIO
from typing import Any, Dict, Optional, Union, cast
import httpx
@ -6,7 +7,7 @@ import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError
from ...types import Response
from ...types import File, Response
def _get_kwargs(
@ -29,7 +30,11 @@ def _get_kwargs(
}
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, File, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK:
response_200 = File(payload=BytesIO(response.content))
return response_200
if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None)
return response_404
@ -43,7 +48,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, File, HTTPValidationError]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
@ -56,7 +61,7 @@ def sync_detailed(
id: str,
*,
client: AuthenticatedClient,
) -> Response[Union[Any, HTTPValidationError]]:
) -> Response[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -69,7 +74,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Response[Union[Any, File, HTTPValidationError]]
"""
kwargs = _get_kwargs(
@ -89,7 +94,7 @@ def sync(
id: str,
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, HTTPValidationError]]:
) -> Optional[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -102,7 +107,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError]
Union[Any, File, HTTPValidationError]
"""
return sync_detailed(
@ -115,7 +120,7 @@ async def asyncio_detailed(
id: str,
*,
client: AuthenticatedClient,
) -> Response[Union[Any, HTTPValidationError]]:
) -> Response[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -128,7 +133,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Response[Union[Any, File, HTTPValidationError]]
"""
kwargs = _get_kwargs(
@ -146,7 +151,7 @@ async def asyncio(
id: str,
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, HTTPValidationError]]:
) -> Optional[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -159,7 +164,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError]
Union[Any, File, HTTPValidationError]
"""
return (

View File

@ -1,4 +1,5 @@
from http import HTTPStatus
from io import BytesIO
from typing import Any, Dict, Optional, Union, cast
import httpx
@ -6,7 +7,7 @@ import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError
from ...types import Response
from ...types import File, Response
def _get_kwargs(
@ -29,7 +30,11 @@ def _get_kwargs(
}
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, File, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK:
response_200 = File(payload=BytesIO(response.content))
return response_200
if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None)
return response_404
@ -43,7 +48,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, File, HTTPValidationError]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
@ -56,7 +61,7 @@ def sync_detailed(
id: str,
*,
client: AuthenticatedClient,
) -> Response[Union[Any, HTTPValidationError]]:
) -> Response[Union[Any, File, HTTPValidationError]]:
"""Video Get
Get a video by id
@ -69,7 +74,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Response[Union[Any, File, HTTPValidationError]]
"""
kwargs = _get_kwargs(
@ -89,7 +94,7 @@ def sync(
id: str,
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, HTTPValidationError]]:
) -> Optional[Union[Any, File, HTTPValidationError]]:
"""Video Get
Get a video by id
@ -102,7 +107,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError]
Union[Any, File, HTTPValidationError]
"""
return sync_detailed(
@ -115,7 +120,7 @@ async def asyncio_detailed(
id: str,
*,
client: AuthenticatedClient,
) -> Response[Union[Any, HTTPValidationError]]:
) -> Response[Union[Any, File, HTTPValidationError]]:
"""Video Get
Get a video by id
@ -128,7 +133,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Response[Union[Any, File, HTTPValidationError]]
"""
kwargs = _get_kwargs(
@ -146,7 +151,7 @@ async def asyncio(
id: str,
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, HTTPValidationError]]:
) -> Optional[Union[Any, File, HTTPValidationError]]:
"""Video Get
Get a video by id
@ -159,7 +164,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError]
Union[Any, File, HTTPValidationError]
"""
return (

View File

@ -7,7 +7,7 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
setup(
name="PhotosAPI_Client",
version="0.3.0",
version="0.4.0",
description="A client library for accessing Photos API",
long_description=long_description,
long_description_content_type="text/markdown",