Updated to PhotosAPI v0.6.0

This commit is contained in:
Profitroll 2024-03-12 12:57:10 +01:00
parent 3ab55ca96f
commit 35aa61a83a
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
58 changed files with 1377 additions and 1043 deletions

3
.gitignore vendored
View File

@ -21,4 +21,5 @@ dmypy.json
/coverage.xml /coverage.xml
/.coverage /.coverage
.vscode .vscode/*
!.vscode/tasks.json

52
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,52 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"linux": {
"command": "./.venv/bin/python -m build ./PhotosAPI_Client"
},
"windows": {
"command": ".\\.venv\\Scripts\\python -m build .\\PhotosAPI_Client"
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Generate",
"type": "shell",
"linux": {
"command": "./.venv/bin/openapi-python-client generate --config ./config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
},
"windows": {
"command": ".\\.venv\\Scripts\\openapi-python-client generate --config .\\config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Update",
"type": "shell",
"linux": {
"command": "./.venv/bin/openapi-python-client update --config ./config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
},
"windows": {
"command": ".\\.venv\\Scripts\\openapi-python-client update --config .\\config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@ -20,5 +20,4 @@ dmypy.json
.idea/ .idea/
/coverage.xml /coverage.xml
/.coverage /.coverage
.vscode

View File

@ -76,20 +76,3 @@ Things to know:
1. All path/query params, and bodies become method arguments. 1. All path/query params, and bodies become method arguments.
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above) 1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
1. Any endpoint which did not have a tag will be in `photosapi_client.api.default` 1. Any endpoint which did not have a tag will be in `photosapi_client.api.default`
## Building / publishing this Client
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
1. Update the metadata in pyproject.toml (e.g. authors, version)
1. If you're using a private repository, configure it with Poetry
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
1. `poetry config http-basic.<your-repository-name> <username> <password>`
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
If you want to install this client into another project without publishing it (e.g. for development) then:
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
1. If that project is not using Poetry:
1. Build a wheel with `poetry build -f wheel`
1. Install that wheel from the other project `pip install <path-to-wheel>`

View File

@ -1,4 +1,5 @@
""" A client library for accessing END PLAY Photos """ """ A client library for accessing END PLAY Photos """
from .client import AuthenticatedClient, Client from .client import AuthenticatedClient, Client
__all__ = ( __all__ = (

View File

@ -12,34 +12,30 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
*, *,
client: AuthenticatedClient,
name: str, name: str,
title: str, title: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums".format(client.base_url)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["name"] = name params["name"] = name
params["title"] = title params["title"] = title
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "post", "method": "post",
"url": url, "url": "/albums",
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Album, Any, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Album, Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = Album.from_dict(response.json()) response_200 = Album.from_dict(response.json())
@ -60,7 +56,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Album, Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Album, Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -92,13 +90,11 @@ def sync_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client,
name=name, name=name,
title=title, title=title,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -157,13 +153,11 @@ async def asyncio_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client,
name=name, name=name,
title=title, title=title,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -11,25 +11,21 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*,
client: AuthenticatedClient,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/album/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "delete", "method": "delete",
"url": url, "url": "/album/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.NO_CONTENT: if response.status_code == HTTPStatus.NO_CONTENT:
response_204 = cast(Any, None) response_204 = cast(Any, None)
return response_204 return response_204
@ -46,7 +42,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -77,11 +75,9 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -136,11 +132,9 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -12,32 +12,26 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
*, *,
client: AuthenticatedClient,
q: str, q: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums".format(client.base_url)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["q"] = q params["q"] = q
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "get", "method": "get",
"url": url, "url": "/albums",
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[HTTPValidationError, SearchResultsAlbum]]: ) -> Optional[Union[HTTPValidationError, SearchResultsAlbum]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = SearchResultsAlbum.from_dict(response.json()) response_200 = SearchResultsAlbum.from_dict(response.json())
@ -54,7 +48,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[HTTPValidationError, SearchResultsAlbum]]: ) -> Response[Union[HTTPValidationError, SearchResultsAlbum]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -85,12 +79,10 @@ def sync_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client,
q=q, q=q,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -144,12 +136,10 @@ async def asyncio_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client,
q=q, q=q,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -13,38 +13,49 @@ from ...types import UNSET, Response, Unset
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*, *,
client: AuthenticatedClient, name: Union[None, Unset, str] = UNSET,
name: Union[Unset, None, str] = UNSET, title: Union[None, Unset, str] = UNSET,
title: Union[Unset, None, str] = UNSET, cover: Union[None, Unset, str] = UNSET,
cover: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["name"] = name
params["title"] = title json_name: Union[None, Unset, str]
if isinstance(name, Unset):
json_name = UNSET
else:
json_name = name
params["name"] = json_name
params["cover"] = cover json_title: Union[None, Unset, str]
if isinstance(title, Unset):
json_title = UNSET
else:
json_title = title
params["title"] = json_title
json_cover: Union[None, Unset, str]
if isinstance(cover, Unset):
json_cover = UNSET
else:
json_cover = cover
params["cover"] = json_cover
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "patch", "method": "patch",
"url": url, "url": "/albums/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = AlbumModified.from_dict(response.json()) response_200 = AlbumModified.from_dict(response.json())
@ -67,7 +78,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -81,9 +92,9 @@ def sync_detailed(
id: str, id: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
name: Union[Unset, None, str] = UNSET, name: Union[None, Unset, str] = UNSET,
title: Union[Unset, None, str] = UNSET, title: Union[None, Unset, str] = UNSET,
cover: Union[Unset, None, str] = UNSET, cover: Union[None, Unset, str] = UNSET,
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
"""Album Patch """Album Patch
@ -91,9 +102,9 @@ def sync_detailed(
Args: Args:
id (str): id (str):
name (Union[Unset, None, str]): name (Union[None, Unset, str]):
title (Union[Unset, None, str]): title (Union[None, Unset, str]):
cover (Union[Unset, None, str]): cover (Union[None, Unset, str]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -105,14 +116,12 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
name=name, name=name,
title=title, title=title,
cover=cover, cover=cover,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -123,9 +132,9 @@ def sync(
id: str, id: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
name: Union[Unset, None, str] = UNSET, name: Union[None, Unset, str] = UNSET,
title: Union[Unset, None, str] = UNSET, title: Union[None, Unset, str] = UNSET,
cover: Union[Unset, None, str] = UNSET, cover: Union[None, Unset, str] = UNSET,
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
"""Album Patch """Album Patch
@ -133,9 +142,9 @@ def sync(
Args: Args:
id (str): id (str):
name (Union[Unset, None, str]): name (Union[None, Unset, str]):
title (Union[Unset, None, str]): title (Union[None, Unset, str]):
cover (Union[Unset, None, str]): cover (Union[None, Unset, str]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -158,9 +167,9 @@ async def asyncio_detailed(
id: str, id: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
name: Union[Unset, None, str] = UNSET, name: Union[None, Unset, str] = UNSET,
title: Union[Unset, None, str] = UNSET, title: Union[None, Unset, str] = UNSET,
cover: Union[Unset, None, str] = UNSET, cover: Union[None, Unset, str] = UNSET,
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
"""Album Patch """Album Patch
@ -168,9 +177,9 @@ async def asyncio_detailed(
Args: Args:
id (str): id (str):
name (Union[Unset, None, str]): name (Union[None, Unset, str]):
title (Union[Unset, None, str]): title (Union[None, Unset, str]):
cover (Union[Unset, None, str]): cover (Union[None, Unset, str]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -182,14 +191,12 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
name=name, name=name,
title=title, title=title,
cover=cover, cover=cover,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -198,9 +205,9 @@ async def asyncio(
id: str, id: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
name: Union[Unset, None, str] = UNSET, name: Union[None, Unset, str] = UNSET,
title: Union[Unset, None, str] = UNSET, title: Union[None, Unset, str] = UNSET,
cover: Union[Unset, None, str] = UNSET, cover: Union[None, Unset, str] = UNSET,
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
"""Album Patch """Album Patch
@ -208,9 +215,9 @@ async def asyncio(
Args: Args:
id (str): id (str):
name (Union[Unset, None, str]): name (Union[None, Unset, str]):
title (Union[Unset, None, str]): title (Union[None, Unset, str]):
cover (Union[Unset, None, str]): cover (Union[None, Unset, str]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

View File

@ -13,17 +13,13 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*, *,
client: AuthenticatedClient,
name: str, name: str,
title: str, title: str,
cover: str, cover: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["name"] = name params["name"] = name
params["title"] = title params["title"] = title
@ -32,19 +28,19 @@ def _get_kwargs(
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "put", "method": "put",
"url": url, "url": "/albums/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = AlbumModified.from_dict(response.json()) response_200 = AlbumModified.from_dict(response.json())
@ -67,7 +63,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]: ) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -105,14 +101,12 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
name=name, name=name,
title=title, title=title,
cover=cover, cover=cover,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -182,14 +176,12 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
name=name, name=name,
title=title, title=title,
cover=cover, cover=cover,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx import httpx
from ... import errors from ... import errors
from ...client import Client from ...client import AuthenticatedClient, Client
from ...models.body_login_for_access_token_token_post import BodyLoginForAccessTokenTokenPost from ...models.body_login_for_access_token_token_post import BodyLoginForAccessTokenTokenPost
from ...models.http_validation_error import HTTPValidationError from ...models.http_validation_error import HTTPValidationError
from ...models.token import Token from ...models.token import Token
@ -13,26 +13,27 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
*, *,
client: Client, body: BodyLoginForAccessTokenTokenPost,
form_data: BodyLoginForAccessTokenTokenPost,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/token".format(client.base_url) headers: Dict[str, Any] = {}
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "post", "method": "post",
"url": url, "url": "/token",
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(),
} }
_body = body.to_dict()
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError, Token]]: _kwargs["data"] = _body
headers["Content-Type"] = "application/x-www-form-urlencoded"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, Token]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = Token.from_dict(response.json()) response_200 = Token.from_dict(response.json())
@ -50,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, Token]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, Token]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -61,11 +64,14 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
def sync_detailed( def sync_detailed(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyLoginForAccessTokenTokenPost, body: BodyLoginForAccessTokenTokenPost,
) -> Response[Union[Any, HTTPValidationError, Token]]: ) -> Response[Union[Any, HTTPValidationError, Token]]:
"""Login For Access Token """Login For Access Token
Args:
body (BodyLoginForAccessTokenTokenPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -75,12 +81,10 @@ def sync_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client, body=body,
form_data=form_data,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -89,11 +93,14 @@ def sync_detailed(
def sync( def sync(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyLoginForAccessTokenTokenPost, body: BodyLoginForAccessTokenTokenPost,
) -> Optional[Union[Any, HTTPValidationError, Token]]: ) -> Optional[Union[Any, HTTPValidationError, Token]]:
"""Login For Access Token """Login For Access Token
Args:
body (BodyLoginForAccessTokenTokenPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -104,17 +111,20 @@ def sync(
return sync_detailed( return sync_detailed(
client=client, client=client,
form_data=form_data, body=body,
).parsed ).parsed
async def asyncio_detailed( async def asyncio_detailed(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyLoginForAccessTokenTokenPost, body: BodyLoginForAccessTokenTokenPost,
) -> Response[Union[Any, HTTPValidationError, Token]]: ) -> Response[Union[Any, HTTPValidationError, Token]]:
"""Login For Access Token """Login For Access Token
Args:
body (BodyLoginForAccessTokenTokenPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -124,23 +134,24 @@ async def asyncio_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client, body=body,
form_data=form_data,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
async def asyncio( async def asyncio(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyLoginForAccessTokenTokenPost, body: BodyLoginForAccessTokenTokenPost,
) -> Optional[Union[Any, HTTPValidationError, Token]]: ) -> Optional[Union[Any, HTTPValidationError, Token]]:
"""Login For Access Token """Login For Access Token
Args:
body (BodyLoginForAccessTokenTokenPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -152,6 +163,6 @@ async def asyncio(
return ( return (
await asyncio_detailed( await asyncio_detailed(
client=client, client=client,
form_data=form_data, body=body,
) )
).parsed ).parsed

View File

@ -11,25 +11,21 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*,
client: AuthenticatedClient,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/photos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "delete", "method": "delete",
"url": url, "url": "/photos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.NO_CONTENT: if response.status_code == HTTPStatus.NO_CONTENT:
response_204 = cast(Any, None) response_204 = cast(Any, None)
return response_204 return response_204
@ -46,7 +42,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -77,11 +75,9 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -136,11 +132,9 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -12,52 +12,80 @@ from ...types import UNSET, Response, Unset
def _get_kwargs( def _get_kwargs(
album: str, album: str,
*, *,
client: AuthenticatedClient, q: Union[None, Unset, str] = UNSET,
q: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, page: Union[Unset, int] = 1,
page: Union[Unset, None, int] = 1, page_size: Union[Unset, int] = 100,
page_size: Union[Unset, None, int] = 100, lat: Union[None, Unset, float] = UNSET,
lat: Union[Unset, None, float] = UNSET, lng: Union[None, Unset, float] = UNSET,
lng: Union[Unset, None, float] = UNSET, radius: Union[None, Unset, int] = UNSET,
radius: Union[Unset, None, int] = UNSET,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{album}/photos".format(client.base_url, album=album)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["q"] = q
params["caption"] = caption json_q: Union[None, Unset, str]
if isinstance(q, Unset):
json_q = UNSET
else:
json_q = q
params["q"] = json_q
params["token"] = token json_caption: Union[None, Unset, str]
if isinstance(caption, Unset):
json_caption = UNSET
else:
json_caption = caption
params["caption"] = json_caption
json_token: Union[None, Unset, str]
if isinstance(token, Unset):
json_token = UNSET
else:
json_token = token
params["token"] = json_token
params["page"] = page params["page"] = page
params["page_size"] = page_size params["page_size"] = page_size
params["lat"] = lat json_lat: Union[None, Unset, float]
if isinstance(lat, Unset):
json_lat = UNSET
else:
json_lat = lat
params["lat"] = json_lat
params["lng"] = lng json_lng: Union[None, Unset, float]
if isinstance(lng, Unset):
json_lng = UNSET
else:
json_lng = lng
params["lng"] = json_lng
params["radius"] = radius json_radius: Union[None, Unset, int]
if isinstance(radius, Unset):
json_radius = UNSET
else:
json_radius = radius
params["radius"] = json_radius
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "get", "method": "get",
"url": url, "url": "/albums/{album}/photos".format(
"headers": headers, album=album,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SearchResultsPhoto]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, SearchResultsPhoto]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = SearchResultsPhoto.from_dict(response.json()) response_200 = SearchResultsPhoto.from_dict(response.json())
@ -80,7 +108,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SearchResultsPhoto]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, SearchResultsPhoto]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -93,14 +123,14 @@ def sync_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
lat: Union[Unset, None, float] = UNSET, lat: Union[None, Unset, float] = UNSET,
lng: Union[Unset, None, float] = UNSET, lng: Union[None, Unset, float] = UNSET,
radius: Union[Unset, None, int] = UNSET, radius: Union[None, Unset, int] = UNSET,
) -> Response[Union[Any, SearchResultsPhoto]]: ) -> Response[Union[Any, SearchResultsPhoto]]:
"""Photo Find """Photo Find
@ -108,14 +138,14 @@ def sync_detailed(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
lat (Union[Unset, None, float]): lat (Union[None, Unset, float]):
lng (Union[Unset, None, float]): lng (Union[None, Unset, float]):
radius (Union[Unset, None, int]): radius (Union[None, Unset, int]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -127,7 +157,6 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
q=q, q=q,
caption=caption, caption=caption,
token=token, token=token,
@ -138,8 +167,7 @@ def sync_detailed(
radius=radius, radius=radius,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -150,14 +178,14 @@ def sync(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
lat: Union[Unset, None, float] = UNSET, lat: Union[None, Unset, float] = UNSET,
lng: Union[Unset, None, float] = UNSET, lng: Union[None, Unset, float] = UNSET,
radius: Union[Unset, None, int] = UNSET, radius: Union[None, Unset, int] = UNSET,
) -> Optional[Union[Any, SearchResultsPhoto]]: ) -> Optional[Union[Any, SearchResultsPhoto]]:
"""Photo Find """Photo Find
@ -165,14 +193,14 @@ def sync(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
lat (Union[Unset, None, float]): lat (Union[None, Unset, float]):
lng (Union[Unset, None, float]): lng (Union[None, Unset, float]):
radius (Union[Unset, None, int]): radius (Union[None, Unset, int]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -200,14 +228,14 @@ async def asyncio_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
lat: Union[Unset, None, float] = UNSET, lat: Union[None, Unset, float] = UNSET,
lng: Union[Unset, None, float] = UNSET, lng: Union[None, Unset, float] = UNSET,
radius: Union[Unset, None, int] = UNSET, radius: Union[None, Unset, int] = UNSET,
) -> Response[Union[Any, SearchResultsPhoto]]: ) -> Response[Union[Any, SearchResultsPhoto]]:
"""Photo Find """Photo Find
@ -215,14 +243,14 @@ async def asyncio_detailed(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
lat (Union[Unset, None, float]): lat (Union[None, Unset, float]):
lng (Union[Unset, None, float]): lng (Union[None, Unset, float]):
radius (Union[Unset, None, int]): radius (Union[None, Unset, int]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -234,7 +262,6 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
q=q, q=q,
caption=caption, caption=caption,
token=token, token=token,
@ -245,8 +272,7 @@ async def asyncio_detailed(
radius=radius, radius=radius,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -255,14 +281,14 @@ async def asyncio(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
lat: Union[Unset, None, float] = UNSET, lat: Union[None, Unset, float] = UNSET,
lng: Union[Unset, None, float] = UNSET, lng: Union[None, Unset, float] = UNSET,
radius: Union[Unset, None, int] = UNSET, radius: Union[None, Unset, int] = UNSET,
) -> Optional[Union[Any, SearchResultsPhoto]]: ) -> Optional[Union[Any, SearchResultsPhoto]]:
"""Photo Find """Photo Find
@ -270,14 +296,14 @@ async def asyncio(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
lat (Union[Unset, None, float]): lat (Union[None, Unset, float]):
lng (Union[Unset, None, float]): lng (Union[None, Unset, float]):
radius (Union[Unset, None, int]): radius (Union[None, Unset, int]):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

View File

@ -12,25 +12,21 @@ from ...types import File, Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*,
client: AuthenticatedClient,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/photos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "get", "method": "get",
"url": url, "url": "/photos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, File, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, File, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = File(payload=BytesIO(response.content)) response_200 = File(payload=BytesIO(response.content))
@ -48,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, File, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, File, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -79,11 +77,9 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -138,11 +134,9 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx import httpx
from ... import errors from ... import errors
from ...client import Client from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError from ...models.http_validation_error import HTTPValidationError
from ...types import UNSET, Response from ...types import UNSET, Response
@ -12,33 +12,31 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
token: str, token: str,
*, *,
client: Client,
id: int, id: int,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/token/photo/{token}".format(client.base_url, token=token)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["id"] = id params["id"] = id
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "get", "method": "get",
"url": url, "url": "/token/photo/{token}".format(
"headers": headers, token=token,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = cast(Any, response.json()) response_200 = response.json()
return response_200 return response_200
if response.status_code == HTTPStatus.UNAUTHORIZED: if response.status_code == HTTPStatus.UNAUTHORIZED:
response_401 = cast(Any, None) response_401 = cast(Any, None)
@ -56,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -68,7 +68,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
def sync_detailed( def sync_detailed(
token: str, token: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
id: int, id: int,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""Photo Get Token """Photo Get Token
@ -89,12 +89,10 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
token=token, token=token,
client=client,
id=id, id=id,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -104,7 +102,7 @@ def sync_detailed(
def sync( def sync(
token: str, token: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
id: int, id: int,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""Photo Get Token """Photo Get Token
@ -133,7 +131,7 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
token: str, token: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
id: int, id: int,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""Photo Get Token """Photo Get Token
@ -154,12 +152,10 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
token=token, token=token,
client=client,
id=id, id=id,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -167,7 +163,7 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
token: str, token: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
id: int, id: int,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""Photo Get Token """Photo Get Token

View File

@ -13,32 +13,28 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*, *,
client: AuthenticatedClient,
album: str, album: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/photos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["album"] = album params["album"] = album
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "put", "method": "put",
"url": url, "url": "/photos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]: ) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = PhotoPublic.from_dict(response.json()) response_200 = PhotoPublic.from_dict(response.json())
@ -58,7 +54,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]: ) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -92,12 +88,10 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
album=album, album=album,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -157,12 +151,10 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
album=album, album=album,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -13,32 +13,28 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*, *,
client: AuthenticatedClient,
caption: str, caption: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/photos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["caption"] = caption params["caption"] = caption
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "patch", "method": "patch",
"url": url, "url": "/photos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]: ) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = PhotoPublic.from_dict(response.json()) response_200 = PhotoPublic.from_dict(response.json())
@ -58,7 +54,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]: ) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -92,12 +88,10 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
caption=caption, caption=caption,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -157,12 +151,10 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
caption=caption, caption=caption,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -13,35 +13,36 @@ from ...types import UNSET, Response, Unset
def _get_kwargs( def _get_kwargs(
album: str, album: str,
*, *,
client: AuthenticatedClient, caption: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, limit: Union[Unset, int] = 100,
limit: Union[Unset, None, int] = 100,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{album}/photos/random".format(client.base_url, album=album)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["caption"] = caption
json_caption: Union[None, Unset, str]
if isinstance(caption, Unset):
json_caption = UNSET
else:
json_caption = caption
params["caption"] = json_caption
params["limit"] = limit params["limit"] = limit
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "get", "method": "get",
"url": url, "url": "/albums/{album}/photos/random".format(
"headers": headers, album=album,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]: ) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = RandomSearchResultsPhoto.from_dict(response.json()) response_200 = RandomSearchResultsPhoto.from_dict(response.json())
@ -64,7 +65,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]: ) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -78,8 +79,8 @@ def sync_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]: ) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random """Photo Random
@ -87,8 +88,8 @@ def sync_detailed(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -100,13 +101,11 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
caption=caption, caption=caption,
limit=limit, limit=limit,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -117,8 +116,8 @@ def sync(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]: ) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random """Photo Random
@ -126,8 +125,8 @@ def sync(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -149,8 +148,8 @@ async def asyncio_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]: ) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random """Photo Random
@ -158,8 +157,8 @@ async def asyncio_detailed(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -171,13 +170,11 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
caption=caption, caption=caption,
limit=limit, limit=limit,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -186,8 +183,8 @@ async def asyncio(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]: ) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random """Photo Random
@ -195,8 +192,8 @@ async def asyncio(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

View File

@ -14,45 +14,54 @@ from ...types import UNSET, Response, Unset
def _get_kwargs( def _get_kwargs(
album: str, album: str,
*, *,
client: AuthenticatedClient, body: BodyPhotoUploadAlbumsAlbumPhotosPost,
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost, ignore_duplicates: Union[Unset, bool] = False,
ignore_duplicates: Union[Unset, None, bool] = False, compress: Union[Unset, bool] = True,
compress: Union[Unset, None, bool] = True, caption: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{album}/photos".format(client.base_url, album=album) headers: Dict[str, Any] = {}
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["ignore_duplicates"] = ignore_duplicates params["ignore_duplicates"] = ignore_duplicates
params["compress"] = compress params["compress"] = compress
params["caption"] = caption json_caption: Union[None, Unset, str]
if isinstance(caption, Unset):
json_caption = UNSET
else:
json_caption = caption
params["caption"] = json_caption
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
multipart_multipart_data = multipart_data.to_multipart() _kwargs: Dict[str, Any] = {
return {
"method": "post", "method": "post",
"url": url, "url": "/albums/{album}/photos".format(
"headers": headers, album=album,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"files": multipart_multipart_data,
"params": params, "params": params,
} }
_body = body.to_multipart()
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError, Photo]]: _kwargs["files"] = _body
_kwargs["headers"] = headers
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, Photo]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = Photo.from_dict(response.json()) response_200 = Photo.from_dict(response.json())
return response_200 return response_200
if response.status_code == HTTPStatus.FORBIDDEN:
response_403 = cast(Any, None)
return response_403
if response.status_code == HTTPStatus.NOT_FOUND: if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None) response_404 = cast(Any, None)
return response_404 return response_404
@ -69,7 +78,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, Photo]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, Photo]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -82,10 +93,10 @@ def sync_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost, body: BodyPhotoUploadAlbumsAlbumPhotosPost,
ignore_duplicates: Union[Unset, None, bool] = False, ignore_duplicates: Union[Unset, bool] = False,
compress: Union[Unset, None, bool] = True, compress: Union[Unset, bool] = True,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Response[Union[Any, HTTPValidationError, Photo]]: ) -> Response[Union[Any, HTTPValidationError, Photo]]:
"""Photo Upload """Photo Upload
@ -93,10 +104,10 @@ def sync_detailed(
Args: Args:
album (str): album (str):
ignore_duplicates (Union[Unset, None, bool]): ignore_duplicates (Union[Unset, bool]): Default: False.
compress (Union[Unset, None, bool]): Default: True. compress (Union[Unset, bool]): Default: True.
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost): body (BodyPhotoUploadAlbumsAlbumPhotosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -108,15 +119,13 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client, body=body,
multipart_data=multipart_data,
ignore_duplicates=ignore_duplicates, ignore_duplicates=ignore_duplicates,
compress=compress, compress=compress,
caption=caption, caption=caption,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -127,10 +136,10 @@ def sync(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost, body: BodyPhotoUploadAlbumsAlbumPhotosPost,
ignore_duplicates: Union[Unset, None, bool] = False, ignore_duplicates: Union[Unset, bool] = False,
compress: Union[Unset, None, bool] = True, compress: Union[Unset, bool] = True,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Optional[Union[Any, HTTPValidationError, Photo]]: ) -> Optional[Union[Any, HTTPValidationError, Photo]]:
"""Photo Upload """Photo Upload
@ -138,10 +147,10 @@ def sync(
Args: Args:
album (str): album (str):
ignore_duplicates (Union[Unset, None, bool]): ignore_duplicates (Union[Unset, bool]): Default: False.
compress (Union[Unset, None, bool]): Default: True. compress (Union[Unset, bool]): Default: True.
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost): body (BodyPhotoUploadAlbumsAlbumPhotosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -154,7 +163,7 @@ def sync(
return sync_detailed( return sync_detailed(
album=album, album=album,
client=client, client=client,
multipart_data=multipart_data, body=body,
ignore_duplicates=ignore_duplicates, ignore_duplicates=ignore_duplicates,
compress=compress, compress=compress,
caption=caption, caption=caption,
@ -165,10 +174,10 @@ async def asyncio_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost, body: BodyPhotoUploadAlbumsAlbumPhotosPost,
ignore_duplicates: Union[Unset, None, bool] = False, ignore_duplicates: Union[Unset, bool] = False,
compress: Union[Unset, None, bool] = True, compress: Union[Unset, bool] = True,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Response[Union[Any, HTTPValidationError, Photo]]: ) -> Response[Union[Any, HTTPValidationError, Photo]]:
"""Photo Upload """Photo Upload
@ -176,10 +185,10 @@ async def asyncio_detailed(
Args: Args:
album (str): album (str):
ignore_duplicates (Union[Unset, None, bool]): ignore_duplicates (Union[Unset, bool]): Default: False.
compress (Union[Unset, None, bool]): Default: True. compress (Union[Unset, bool]): Default: True.
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost): body (BodyPhotoUploadAlbumsAlbumPhotosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -191,15 +200,13 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client, body=body,
multipart_data=multipart_data,
ignore_duplicates=ignore_duplicates, ignore_duplicates=ignore_duplicates,
compress=compress, compress=compress,
caption=caption, caption=caption,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -208,10 +215,10 @@ async def asyncio(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost, body: BodyPhotoUploadAlbumsAlbumPhotosPost,
ignore_duplicates: Union[Unset, None, bool] = False, ignore_duplicates: Union[Unset, bool] = False,
compress: Union[Unset, None, bool] = True, compress: Union[Unset, bool] = True,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Optional[Union[Any, HTTPValidationError, Photo]]: ) -> Optional[Union[Any, HTTPValidationError, Photo]]:
"""Photo Upload """Photo Upload
@ -219,10 +226,10 @@ async def asyncio(
Args: Args:
album (str): album (str):
ignore_duplicates (Union[Unset, None, bool]): ignore_duplicates (Union[Unset, bool]): Default: False.
compress (Union[Unset, None, bool]): Default: True. compress (Union[Unset, bool]): Default: True.
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost): body (BodyPhotoUploadAlbumsAlbumPhotosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -236,7 +243,7 @@ async def asyncio(
await asyncio_detailed( await asyncio_detailed(
album=album, album=album,
client=client, client=client,
multipart_data=multipart_data, body=body,
ignore_duplicates=ignore_duplicates, ignore_duplicates=ignore_duplicates,
compress=compress, compress=compress,
caption=caption, caption=caption,

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx import httpx
from ... import errors from ... import errors
from ...client import Client from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError from ...models.http_validation_error import HTTPValidationError
from ...types import UNSET, Response from ...types import UNSET, Response
@ -12,33 +12,31 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
user: str, user: str,
*, *,
client: Client,
code: str, code: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/users/{user}/confirm".format(client.base_url, user=user)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["code"] = code params["code"] = code
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "get", "method": "get",
"url": url, "url": "/users/{user}/confirm".format(
"headers": headers, user=user,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = cast(Any, response.json()) response_200 = response.json()
return response_200 return response_200
if response.status_code == HTTPStatus.BAD_REQUEST: if response.status_code == HTTPStatus.BAD_REQUEST:
response_400 = cast(Any, None) response_400 = cast(Any, None)
@ -53,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -65,7 +65,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
def sync_detailed( def sync_detailed(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm
@ -84,12 +84,10 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
user=user, user=user,
client=client,
code=code, code=code,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -99,7 +97,7 @@ def sync_detailed(
def sync( def sync(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm
@ -126,7 +124,7 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm
@ -145,12 +143,10 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
user=user, user=user,
client=client,
code=code, code=code,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -158,7 +154,7 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx import httpx
from ... import errors from ... import errors
from ...client import Client from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError from ...models.http_validation_error import HTTPValidationError
from ...types import UNSET, Response from ...types import UNSET, Response
@ -12,33 +12,31 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
user: str, user: str,
*, *,
client: Client,
code: str, code: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/users/{user}/confirm".format(client.base_url, user=user)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["code"] = code params["code"] = code
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "patch", "method": "patch",
"url": url, "url": "/users/{user}/confirm".format(
"headers": headers, user=user,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = cast(Any, response.json()) response_200 = response.json()
return response_200 return response_200
if response.status_code == HTTPStatus.BAD_REQUEST: if response.status_code == HTTPStatus.BAD_REQUEST:
response_400 = cast(Any, None) response_400 = cast(Any, None)
@ -53,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -65,7 +65,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
def sync_detailed( def sync_detailed(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm
@ -84,12 +84,10 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
user=user, user=user,
client=client,
code=code, code=code,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -99,7 +97,7 @@ def sync_detailed(
def sync( def sync(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm
@ -126,7 +124,7 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm
@ -145,12 +143,10 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
user=user, user=user,
client=client,
code=code, code=code,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -158,7 +154,7 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
user: str, user: str,
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
code: str, code: str,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Confirm """User Confirm

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx import httpx
from ... import errors from ... import errors
from ...client import Client from ...client import AuthenticatedClient, Client
from ...models.body_user_create_users_post import BodyUserCreateUsersPost from ...models.body_user_create_users_post import BodyUserCreateUsersPost
from ...models.http_validation_error import HTTPValidationError from ...models.http_validation_error import HTTPValidationError
from ...types import Response from ...types import Response
@ -12,26 +12,27 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
*, *,
client: Client, body: BodyUserCreateUsersPost,
form_data: BodyUserCreateUsersPost,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/users".format(client.base_url) headers: Dict[str, Any] = {}
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "post", "method": "post",
"url": url, "url": "/users",
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(),
} }
_body = body.to_dict()
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: _kwargs["data"] = _body
headers["Content-Type"] = "application/x-www-form-urlencoded"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.NO_CONTENT: if response.status_code == HTTPStatus.NO_CONTENT:
response_204 = cast(Any, None) response_204 = cast(Any, None)
return response_204 return response_204
@ -48,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -59,11 +62,14 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
def sync_detailed( def sync_detailed(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyUserCreateUsersPost, body: BodyUserCreateUsersPost,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Create """User Create
Args:
body (BodyUserCreateUsersPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -73,12 +79,10 @@ def sync_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client, body=body,
form_data=form_data,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -87,11 +91,14 @@ def sync_detailed(
def sync( def sync(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyUserCreateUsersPost, body: BodyUserCreateUsersPost,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Create """User Create
Args:
body (BodyUserCreateUsersPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -102,17 +109,20 @@ def sync(
return sync_detailed( return sync_detailed(
client=client, client=client,
form_data=form_data, body=body,
).parsed ).parsed
async def asyncio_detailed( async def asyncio_detailed(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyUserCreateUsersPost, body: BodyUserCreateUsersPost,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Create """User Create
Args:
body (BodyUserCreateUsersPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -122,23 +132,24 @@ async def asyncio_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client, body=body,
form_data=form_data,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
async def asyncio( async def asyncio(
*, *,
client: Client, client: Union[AuthenticatedClient, Client],
form_data: BodyUserCreateUsersPost, body: BodyUserCreateUsersPost,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Create """User Create
Args:
body (BodyUserCreateUsersPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -150,6 +161,6 @@ async def asyncio(
return ( return (
await asyncio_detailed( await asyncio_detailed(
client=client, client=client,
form_data=form_data, body=body,
) )
).parsed ).parsed

View File

@ -12,26 +12,27 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
*, *,
client: AuthenticatedClient, body: BodyUserDeleteUsersMeDelete,
form_data: BodyUserDeleteUsersMeDelete,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/users/me/".format(client.base_url) headers: Dict[str, Any] = {}
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "delete", "method": "delete",
"url": url, "url": "/users/me/",
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(),
} }
_body = body.to_dict()
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: _kwargs["data"] = _body
headers["Content-Type"] = "application/x-www-form-urlencoded"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.NO_CONTENT: if response.status_code == HTTPStatus.NO_CONTENT:
response_204 = cast(Any, None) response_204 = cast(Any, None)
return response_204 return response_204
@ -48,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -60,10 +63,13 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
def sync_detailed( def sync_detailed(
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
form_data: BodyUserDeleteUsersMeDelete, body: BodyUserDeleteUsersMeDelete,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Delete """User Delete
Args:
body (BodyUserDeleteUsersMeDelete):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -73,12 +79,10 @@ def sync_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client, body=body,
form_data=form_data,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -88,10 +92,13 @@ def sync_detailed(
def sync( def sync(
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
form_data: BodyUserDeleteUsersMeDelete, body: BodyUserDeleteUsersMeDelete,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Delete """User Delete
Args:
body (BodyUserDeleteUsersMeDelete):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -102,17 +109,20 @@ def sync(
return sync_detailed( return sync_detailed(
client=client, client=client,
form_data=form_data, body=body,
).parsed ).parsed
async def asyncio_detailed( async def asyncio_detailed(
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
form_data: BodyUserDeleteUsersMeDelete, body: BodyUserDeleteUsersMeDelete,
) -> Response[Union[Any, HTTPValidationError]]: ) -> Response[Union[Any, HTTPValidationError]]:
"""User Delete """User Delete
Args:
body (BodyUserDeleteUsersMeDelete):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -122,12 +132,10 @@ async def asyncio_detailed(
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs(
client=client, body=body,
form_data=form_data,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -135,10 +143,13 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
form_data: BodyUserDeleteUsersMeDelete, body: BodyUserDeleteUsersMeDelete,
) -> Optional[Union[Any, HTTPValidationError]]: ) -> Optional[Union[Any, HTTPValidationError]]:
"""User Delete """User Delete
Args:
body (BodyUserDeleteUsersMeDelete):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 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. httpx.TimeoutException: If the request takes longer than Client.timeout.
@ -150,6 +161,6 @@ async def asyncio(
return ( return (
await asyncio_detailed( await asyncio_detailed(
client=client, client=client,
form_data=form_data, body=body,
) )
).parsed ).parsed

View File

@ -1,5 +1,5 @@
from http import HTTPStatus from http import HTTPStatus
from typing import Any, Dict, Optional from typing import Any, Dict, Optional, Union
import httpx import httpx
@ -9,26 +9,17 @@ from ...models.user import User
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs() -> Dict[str, Any]:
*,
client: AuthenticatedClient,
) -> Dict[str, Any]:
url = "{}/users/me/".format(client.base_url)
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "get", "method": "get",
"url": url, "url": "/users/me/",
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[User]:
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[User]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = User.from_dict(response.json()) response_200 = User.from_dict(response.json())
@ -39,7 +30,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Use
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[User]: def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[User]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -62,12 +53,9 @@ def sync_detailed(
Response[User] Response[User]
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs()
client=client,
)
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -107,12 +95,9 @@ async def asyncio_detailed(
Response[User] Response[User]
""" """
kwargs = _get_kwargs( kwargs = _get_kwargs()
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -11,25 +11,21 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*,
client: AuthenticatedClient,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/videos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "delete", "method": "delete",
"url": url, "url": "/videos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.NO_CONTENT: if response.status_code == HTTPStatus.NO_CONTENT:
response_204 = cast(Any, None) response_204 = cast(Any, None)
return response_204 return response_204
@ -46,7 +42,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -77,11 +75,9 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -136,11 +132,9 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -12,24 +12,35 @@ from ...types import UNSET, Response, Unset
def _get_kwargs( def _get_kwargs(
album: str, album: str,
*, *,
client: AuthenticatedClient, q: Union[None, Unset, str] = UNSET,
q: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, page: Union[Unset, int] = 1,
page: Union[Unset, None, int] = 1, page_size: Union[Unset, int] = 100,
page_size: Union[Unset, None, int] = 100,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{album}/videos".format(client.base_url, album=album)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["q"] = q
params["caption"] = caption json_q: Union[None, Unset, str]
if isinstance(q, Unset):
json_q = UNSET
else:
json_q = q
params["q"] = json_q
params["token"] = token json_caption: Union[None, Unset, str]
if isinstance(caption, Unset):
json_caption = UNSET
else:
json_caption = caption
params["caption"] = json_caption
json_token: Union[None, Unset, str]
if isinstance(token, Unset):
json_token = UNSET
else:
json_token = token
params["token"] = json_token
params["page"] = page params["page"] = page
@ -37,18 +48,20 @@ def _get_kwargs(
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "get", "method": "get",
"url": url, "url": "/albums/{album}/videos".format(
"headers": headers, album=album,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SearchResultsVideo]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, SearchResultsVideo]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = SearchResultsVideo.from_dict(response.json()) response_200 = SearchResultsVideo.from_dict(response.json())
@ -71,7 +84,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SearchResultsVideo]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, SearchResultsVideo]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -84,11 +99,11 @@ def sync_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
) -> Response[Union[Any, SearchResultsVideo]]: ) -> Response[Union[Any, SearchResultsVideo]]:
"""Video Find """Video Find
@ -96,11 +111,11 @@ def sync_detailed(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -112,7 +127,6 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
q=q, q=q,
caption=caption, caption=caption,
token=token, token=token,
@ -120,8 +134,7 @@ def sync_detailed(
page_size=page_size, page_size=page_size,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -132,11 +145,11 @@ def sync(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
) -> Optional[Union[Any, SearchResultsVideo]]: ) -> Optional[Union[Any, SearchResultsVideo]]:
"""Video Find """Video Find
@ -144,11 +157,11 @@ def sync(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -173,11 +186,11 @@ async def asyncio_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
) -> Response[Union[Any, SearchResultsVideo]]: ) -> Response[Union[Any, SearchResultsVideo]]:
"""Video Find """Video Find
@ -185,11 +198,11 @@ async def asyncio_detailed(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -201,7 +214,6 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
q=q, q=q,
caption=caption, caption=caption,
token=token, token=token,
@ -209,8 +221,7 @@ async def asyncio_detailed(
page_size=page_size, page_size=page_size,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -219,11 +230,11 @@ async def asyncio(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
q: Union[Unset, None, str] = UNSET, q: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
token: Union[Unset, None, str] = UNSET, token: Union[None, Unset, str] = UNSET,
page: Union[Unset, None, int] = 1, page: Union[Unset, int] = 1,
page_size: Union[Unset, None, int] = 100, page_size: Union[Unset, int] = 100,
) -> Optional[Union[Any, SearchResultsVideo]]: ) -> Optional[Union[Any, SearchResultsVideo]]:
"""Video Find """Video Find
@ -231,11 +242,11 @@ async def asyncio(
Args: Args:
album (str): album (str):
q (Union[Unset, None, str]): q (Union[None, Unset, str]):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
token (Union[Unset, None, str]): token (Union[None, Unset, str]):
page (Union[Unset, None, int]): Default: 1. page (Union[Unset, int]): Default: 1.
page_size (Union[Unset, None, int]): Default: 100. page_size (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

View File

@ -12,25 +12,21 @@ from ...types import File, Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*,
client: AuthenticatedClient,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/videos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers() _kwargs: Dict[str, Any] = {
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "get", "method": "get",
"url": url, "url": "/videos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
return _kwargs
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, File, HTTPValidationError]]:
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, File, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = File(payload=BytesIO(response.content)) response_200 = File(payload=BytesIO(response.content))
@ -48,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, File, HTTPValidationError]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, File, HTTPValidationError]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -79,11 +77,9 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -138,11 +134,9 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -13,32 +13,28 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*, *,
client: AuthenticatedClient,
album: str, album: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/videos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["album"] = album params["album"] = album
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "put", "method": "put",
"url": url, "url": "/videos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]: ) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = VideoPublic.from_dict(response.json()) response_200 = VideoPublic.from_dict(response.json())
@ -58,7 +54,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]: ) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -92,12 +88,10 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
album=album, album=album,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -157,12 +151,10 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
album=album, album=album,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -13,32 +13,28 @@ from ...types import UNSET, Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
*, *,
client: AuthenticatedClient,
caption: str, caption: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/videos/{id}".format(client.base_url, id=id)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["caption"] = caption params["caption"] = caption
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "patch", "method": "patch",
"url": url, "url": "/videos/{id}".format(
"headers": headers, id=id,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]: ) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = VideoPublic.from_dict(response.json()) response_200 = VideoPublic.from_dict(response.json())
@ -58,7 +54,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]: ) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -92,12 +88,10 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
caption=caption, caption=caption,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -157,12 +151,10 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
client=client,
caption=caption, caption=caption,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)

View File

@ -13,35 +13,36 @@ from ...types import UNSET, Response, Unset
def _get_kwargs( def _get_kwargs(
album: str, album: str,
*, *,
client: AuthenticatedClient, caption: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET, limit: Union[Unset, int] = 100,
limit: Union[Unset, None, int] = 100,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{album}/videos/random".format(client.base_url, album=album)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["caption"] = caption
json_caption: Union[None, Unset, str]
if isinstance(caption, Unset):
json_caption = UNSET
else:
json_caption = caption
params["caption"] = json_caption
params["limit"] = limit params["limit"] = limit
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return { _kwargs: Dict[str, Any] = {
"method": "get", "method": "get",
"url": url, "url": "/albums/{album}/videos/random".format(
"headers": headers, album=album,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
return _kwargs
def _parse_response( def _parse_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]: ) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = RandomSearchResultsVideo.from_dict(response.json()) response_200 = RandomSearchResultsVideo.from_dict(response.json())
@ -64,7 +65,7 @@ def _parse_response(
def _build_response( def _build_response(
*, client: Client, response: httpx.Response *, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]: ) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
@ -78,8 +79,8 @@ def sync_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]: ) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
"""Video Random """Video Random
@ -87,8 +88,8 @@ def sync_detailed(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -100,13 +101,11 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
caption=caption, caption=caption,
limit=limit, limit=limit,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -117,8 +116,8 @@ def sync(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]: ) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
"""Video Random """Video Random
@ -126,8 +125,8 @@ def sync(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -149,8 +148,8 @@ async def asyncio_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]: ) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
"""Video Random """Video Random
@ -158,8 +157,8 @@ async def asyncio_detailed(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -171,13 +170,11 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client,
caption=caption, caption=caption,
limit=limit, limit=limit,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -186,8 +183,8 @@ async def asyncio(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
limit: Union[Unset, None, int] = 100, limit: Union[Unset, int] = 100,
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]: ) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
"""Video Random """Video Random
@ -195,8 +192,8 @@ async def asyncio(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
limit (Union[Unset, None, int]): Default: 100. limit (Union[Unset, int]): Default: 100.
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

View File

@ -14,39 +14,48 @@ from ...types import UNSET, Response, Unset
def _get_kwargs( def _get_kwargs(
album: str, album: str,
*, *,
client: AuthenticatedClient, body: BodyVideoUploadAlbumsAlbumVideosPost,
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost, caption: Union[None, Unset, str] = UNSET,
caption: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/albums/{album}/videos".format(client.base_url, album=album) headers: Dict[str, Any] = {}
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {} params: Dict[str, Any] = {}
params["caption"] = caption
json_caption: Union[None, Unset, str]
if isinstance(caption, Unset):
json_caption = UNSET
else:
json_caption = caption
params["caption"] = json_caption
params = {k: v for k, v in params.items() if v is not UNSET and v is not None} params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
multipart_multipart_data = multipart_data.to_multipart() _kwargs: Dict[str, Any] = {
return {
"method": "post", "method": "post",
"url": url, "url": "/albums/{album}/videos".format(
"headers": headers, album=album,
"cookies": cookies, ),
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"files": multipart_multipart_data,
"params": params, "params": params,
} }
_body = body.to_multipart()
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError, Video]]: _kwargs["files"] = _body
_kwargs["headers"] = headers
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, Video]]:
if response.status_code == HTTPStatus.OK: if response.status_code == HTTPStatus.OK:
response_200 = Video.from_dict(response.json()) response_200 = Video.from_dict(response.json())
return response_200 return response_200
if response.status_code == HTTPStatus.FORBIDDEN:
response_403 = cast(Any, None)
return response_403
if response.status_code == HTTPStatus.NOT_FOUND: if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None) response_404 = cast(Any, None)
return response_404 return response_404
@ -60,7 +69,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return None return None
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, Video]]: def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, Video]]:
return Response( return Response(
status_code=HTTPStatus(response.status_code), status_code=HTTPStatus(response.status_code),
content=response.content, content=response.content,
@ -73,8 +84,8 @@ def sync_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost, body: BodyVideoUploadAlbumsAlbumVideosPost,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Response[Union[Any, HTTPValidationError, Video]]: ) -> Response[Union[Any, HTTPValidationError, Video]]:
"""Video Upload """Video Upload
@ -82,8 +93,8 @@ def sync_detailed(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost): body (BodyVideoUploadAlbumsAlbumVideosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -95,13 +106,11 @@ def sync_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client, body=body,
multipart_data=multipart_data,
caption=caption, caption=caption,
) )
response = httpx.request( response = client.get_httpx_client().request(
verify=client.verify_ssl,
**kwargs, **kwargs,
) )
@ -112,8 +121,8 @@ def sync(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost, body: BodyVideoUploadAlbumsAlbumVideosPost,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Optional[Union[Any, HTTPValidationError, Video]]: ) -> Optional[Union[Any, HTTPValidationError, Video]]:
"""Video Upload """Video Upload
@ -121,8 +130,8 @@ def sync(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost): body (BodyVideoUploadAlbumsAlbumVideosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -135,7 +144,7 @@ def sync(
return sync_detailed( return sync_detailed(
album=album, album=album,
client=client, client=client,
multipart_data=multipart_data, body=body,
caption=caption, caption=caption,
).parsed ).parsed
@ -144,8 +153,8 @@ async def asyncio_detailed(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost, body: BodyVideoUploadAlbumsAlbumVideosPost,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Response[Union[Any, HTTPValidationError, Video]]: ) -> Response[Union[Any, HTTPValidationError, Video]]:
"""Video Upload """Video Upload
@ -153,8 +162,8 @@ async def asyncio_detailed(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost): body (BodyVideoUploadAlbumsAlbumVideosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -166,13 +175,11 @@ async def asyncio_detailed(
kwargs = _get_kwargs( kwargs = _get_kwargs(
album=album, album=album,
client=client, body=body,
multipart_data=multipart_data,
caption=caption, caption=caption,
) )
async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await client.get_async_httpx_client().request(**kwargs)
response = await _client.request(**kwargs)
return _build_response(client=client, response=response) return _build_response(client=client, response=response)
@ -181,8 +188,8 @@ async def asyncio(
album: str, album: str,
*, *,
client: AuthenticatedClient, client: AuthenticatedClient,
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost, body: BodyVideoUploadAlbumsAlbumVideosPost,
caption: Union[Unset, None, str] = UNSET, caption: Union[None, Unset, str] = UNSET,
) -> Optional[Union[Any, HTTPValidationError, Video]]: ) -> Optional[Union[Any, HTTPValidationError, Video]]:
"""Video Upload """Video Upload
@ -190,8 +197,8 @@ async def asyncio(
Args: Args:
album (str): album (str):
caption (Union[Unset, None, str]): caption (Union[None, Unset, str]):
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost): body (BodyVideoUploadAlbumsAlbumVideosPost):
Raises: Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -205,7 +212,7 @@ async def asyncio(
await asyncio_detailed( await asyncio_detailed(
album=album, album=album,
client=client, client=client,
multipart_data=multipart_data, body=body,
caption=caption, caption=caption,
) )
).parsed ).parsed

View File

@ -1,66 +1,268 @@
import ssl import ssl
from typing import Dict, Union from typing import Any, Dict, Optional, Union
import attr import httpx
from attrs import define, evolve, field
@attr.s(auto_attribs=True) @define
class Client: class Client:
"""A class for keeping track of data related to the API """A class for keeping track of data related to the API
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
``cookies``: A dictionary of cookies to be sent with every request
``headers``: A dictionary of headers to be sent with every request
``timeout``: The maximum amount of a time a request can take. API functions will raise
httpx.TimeoutException if this is exceeded.
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
but can be set to False for testing purposes.
``follow_redirects``: Whether or not to follow redirects. Default value is False.
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
Attributes: Attributes:
base_url: The base URL for the API, all requests are made to a relative path to this URL
cookies: A dictionary of cookies to be sent with every request
headers: A dictionary of headers to be sent with every request
timeout: The maximum amount of a time in seconds a request can take. API functions will raise
httpx.TimeoutException if this is exceeded.
verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production,
but can be set to False for testing purposes.
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
status code that was not documented in the source OpenAPI document. status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
follow_redirects: Whether or not to follow redirects. Default value is False. argument to the constructor.
""" """
base_url: str raise_on_unexpected_status: bool = field(default=False, kw_only=True)
cookies: Dict[str, str] = attr.ib(factory=dict, kw_only=True) _base_url: str
headers: Dict[str, str] = attr.ib(factory=dict, kw_only=True) _cookies: Dict[str, str] = field(factory=dict, kw_only=True)
timeout: float = attr.ib(5.0, kw_only=True) _headers: Dict[str, str] = field(factory=dict, kw_only=True)
verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, kw_only=True) _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True)
raise_on_unexpected_status: bool = attr.ib(False, kw_only=True) _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True)
follow_redirects: bool = attr.ib(False, kw_only=True) _follow_redirects: bool = field(default=False, kw_only=True)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True)
def get_headers(self) -> Dict[str, str]: _client: Optional[httpx.Client] = field(default=None, init=False)
"""Get headers to be used in all endpoints""" _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
return {**self.headers}
def with_headers(self, headers: Dict[str, str]) -> "Client": def with_headers(self, headers: Dict[str, str]) -> "Client":
"""Get a new client matching this one with additional headers""" """Get a new client matching this one with additional headers"""
return attr.evolve(self, headers={**self.headers, **headers}) if self._client is not None:
self._client.headers.update(headers)
def get_cookies(self) -> Dict[str, str]: if self._async_client is not None:
return {**self.cookies} self._async_client.headers.update(headers)
return evolve(self, headers={**self._headers, **headers})
def with_cookies(self, cookies: Dict[str, str]) -> "Client": def with_cookies(self, cookies: Dict[str, str]) -> "Client":
"""Get a new client matching this one with additional cookies""" """Get a new client matching this one with additional cookies"""
return attr.evolve(self, cookies={**self.cookies, **cookies}) if self._client is not None:
self._client.cookies.update(cookies)
if self._async_client is not None:
self._async_client.cookies.update(cookies)
return evolve(self, cookies={**self._cookies, **cookies})
def get_timeout(self) -> float: def with_timeout(self, timeout: httpx.Timeout) -> "Client":
return self.timeout
def with_timeout(self, timeout: float) -> "Client":
"""Get a new client matching this one with a new timeout (in seconds)""" """Get a new client matching this one with a new timeout (in seconds)"""
return attr.evolve(self, timeout=timeout) if self._client is not None:
self._client.timeout = timeout
if self._async_client is not None:
self._async_client.timeout = timeout
return evolve(self, timeout=timeout)
def set_httpx_client(self, client: httpx.Client) -> "Client":
"""Manually the underlying httpx.Client
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._client = client
return self
def get_httpx_client(self) -> httpx.Client:
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
if self._client is None:
self._client = httpx.Client(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._client
def __enter__(self) -> "Client":
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
self.get_httpx_client().__enter__()
return self
def __exit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
self.get_httpx_client().__exit__(*args, **kwargs)
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
"""Manually the underlying httpx.AsyncClient
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._async_client = async_client
return self
def get_async_httpx_client(self) -> httpx.AsyncClient:
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
if self._async_client is None:
self._async_client = httpx.AsyncClient(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._async_client
async def __aenter__(self) -> "Client":
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
await self.get_async_httpx_client().__aenter__()
return self
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
@attr.s(auto_attribs=True) @define
class AuthenticatedClient(Client): class AuthenticatedClient:
"""A Client which has been authenticated for use on secured endpoints""" """A Client which has been authenticated for use on secured endpoints
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
``cookies``: A dictionary of cookies to be sent with every request
``headers``: A dictionary of headers to be sent with every request
``timeout``: The maximum amount of a time a request can take. API functions will raise
httpx.TimeoutException if this is exceeded.
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
but can be set to False for testing purposes.
``follow_redirects``: Whether or not to follow redirects. Default value is False.
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
Attributes:
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
argument to the constructor.
token: The token to use for authentication
prefix: The prefix to use for the Authorization header
auth_header_name: The name of the Authorization header
"""
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
_base_url: str
_cookies: Dict[str, str] = field(factory=dict, kw_only=True)
_headers: Dict[str, str] = field(factory=dict, kw_only=True)
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True)
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True)
_follow_redirects: bool = field(default=False, kw_only=True)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True)
_client: Optional[httpx.Client] = field(default=None, init=False)
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
token: str token: str
prefix: str = "Bearer" prefix: str = "Bearer"
auth_header_name: str = "Authorization" auth_header_name: str = "Authorization"
def get_headers(self) -> Dict[str, str]: def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient":
"""Get headers to be used in authenticated endpoints""" """Get a new client matching this one with additional headers"""
auth_header_value = f"{self.prefix} {self.token}" if self.prefix else self.token if self._client is not None:
return {self.auth_header_name: auth_header_value, **self.headers} self._client.headers.update(headers)
if self._async_client is not None:
self._async_client.headers.update(headers)
return evolve(self, headers={**self._headers, **headers})
def with_cookies(self, cookies: Dict[str, str]) -> "AuthenticatedClient":
"""Get a new client matching this one with additional cookies"""
if self._client is not None:
self._client.cookies.update(cookies)
if self._async_client is not None:
self._async_client.cookies.update(cookies)
return evolve(self, cookies={**self._cookies, **cookies})
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
"""Get a new client matching this one with a new timeout (in seconds)"""
if self._client is not None:
self._client.timeout = timeout
if self._async_client is not None:
self._async_client.timeout = timeout
return evolve(self, timeout=timeout)
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
"""Manually the underlying httpx.Client
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._client = client
return self
def get_httpx_client(self) -> httpx.Client:
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
if self._client is None:
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
self._client = httpx.Client(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._client
def __enter__(self) -> "AuthenticatedClient":
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
self.get_httpx_client().__enter__()
return self
def __exit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
self.get_httpx_client().__exit__(*args, **kwargs)
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
"""Manually the underlying httpx.AsyncClient
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._async_client = async_client
return self
def get_async_httpx_client(self) -> httpx.AsyncClient:
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
if self._async_client is None:
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
self._async_client = httpx.AsyncClient(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._async_client
async def __aenter__(self) -> "AuthenticatedClient":
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
await self.get_async_httpx_client().__aenter__()
return self
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
await self.get_async_httpx_client().__aexit__(*args, **kwargs)

View File

@ -8,7 +8,9 @@ class UnexpectedStatus(Exception):
self.status_code = status_code self.status_code = status_code
self.content = content self.content = content
super().__init__(f"Unexpected status code: {status_code}") super().__init__(
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
)
__all__ = ["UnexpectedStatus"] __all__ = ["UnexpectedStatus"]

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="Album") T = TypeVar("T", bound="Album")
@attr.s(auto_attribs=True) @_attrs_define
class Album: class Album:
""" """
Attributes: Attributes:
@ -17,11 +18,13 @@ class Album:
id: str id: str
name: str name: str
title: str title: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
id = self.id id = self.id
name = self.name name = self.name
title = self.title title = self.title
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,29 +1,31 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="AlbumModified") T = TypeVar("T", bound="AlbumModified")
@attr.s(auto_attribs=True) @_attrs_define
class AlbumModified: class AlbumModified:
""" """
Attributes: Attributes:
name (str): name (str):
title (str): title (str):
cover (Union[Unset, str]): cover (Union[None, str]):
""" """
name: str name: str
title: str title: str
cover: Union[Unset, str] = UNSET cover: Union[None, str]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
name = self.name name = self.name
title = self.title title = self.title
cover: Union[None, str]
cover = self.cover cover = self.cover
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -32,10 +34,9 @@ class AlbumModified:
{ {
"name": name, "name": name,
"title": title, "title": title,
"cover": cover,
} }
) )
if cover is not UNSET:
field_dict["cover"] = cover
return field_dict return field_dict
@ -46,7 +47,12 @@ class AlbumModified:
title = d.pop("title") title = d.pop("title")
cover = d.pop("cover", UNSET) def _parse_cover(data: object) -> Union[None, str]:
if data is None:
return data
return cast(Union[None, str], data)
cover = _parse_cover(d.pop("cover"))
album_modified = cls( album_modified = cls(
name=name, name=name,

View File

@ -1,39 +1,57 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset from ..types import UNSET, Unset
T = TypeVar("T", bound="BodyLoginForAccessTokenTokenPost") T = TypeVar("T", bound="BodyLoginForAccessTokenTokenPost")
@attr.s(auto_attribs=True) @_attrs_define
class BodyLoginForAccessTokenTokenPost: class BodyLoginForAccessTokenTokenPost:
""" """
Attributes: Attributes:
username (str): username (str):
password (str): password (str):
grant_type (Union[Unset, str]): grant_type (Union[None, Unset, str]):
scope (Union[Unset, str]): Default: ''. scope (Union[Unset, str]): Default: ''.
client_id (Union[Unset, str]): client_id (Union[None, Unset, str]):
client_secret (Union[Unset, str]): client_secret (Union[None, Unset, str]):
""" """
username: str username: str
password: str password: str
grant_type: Union[Unset, str] = UNSET grant_type: Union[None, Unset, str] = UNSET
scope: Union[Unset, str] = "" scope: Union[Unset, str] = ""
client_id: Union[Unset, str] = UNSET client_id: Union[None, Unset, str] = UNSET
client_secret: Union[Unset, str] = UNSET client_secret: Union[None, Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
username = self.username username = self.username
password = self.password password = self.password
grant_type = self.grant_type
grant_type: Union[None, Unset, str]
if isinstance(self.grant_type, Unset):
grant_type = UNSET
else:
grant_type = self.grant_type
scope = self.scope scope = self.scope
client_id = self.client_id
client_secret = self.client_secret client_id: Union[None, Unset, str]
if isinstance(self.client_id, Unset):
client_id = UNSET
else:
client_id = self.client_id
client_secret: Union[None, Unset, str]
if isinstance(self.client_secret, Unset):
client_secret = UNSET
else:
client_secret = self.client_secret
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties) field_dict.update(self.additional_properties)
@ -61,13 +79,34 @@ class BodyLoginForAccessTokenTokenPost:
password = d.pop("password") password = d.pop("password")
grant_type = d.pop("grant_type", UNSET) def _parse_grant_type(data: object) -> Union[None, Unset, str]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, str], data)
grant_type = _parse_grant_type(d.pop("grant_type", UNSET))
scope = d.pop("scope", UNSET) scope = d.pop("scope", UNSET)
client_id = d.pop("client_id", UNSET) def _parse_client_id(data: object) -> Union[None, Unset, str]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, str], data)
client_secret = d.pop("client_secret", UNSET) client_id = _parse_client_id(d.pop("client_id", UNSET))
def _parse_client_secret(data: object) -> Union[None, Unset, str]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, str], data)
client_secret = _parse_client_secret(d.pop("client_secret", UNSET))
body_login_for_access_token_token_post = cls( body_login_for_access_token_token_post = cls(
username=username, username=username,

View File

@ -1,14 +1,15 @@
from io import BytesIO from io import BytesIO
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import File from ..types import File
T = TypeVar("T", bound="BodyPhotoUploadAlbumsAlbumPhotosPost") T = TypeVar("T", bound="BodyPhotoUploadAlbumsAlbumPhotosPost")
@attr.s(auto_attribs=True) @_attrs_define
class BodyPhotoUploadAlbumsAlbumPhotosPost: class BodyPhotoUploadAlbumsAlbumPhotosPost:
""" """
Attributes: Attributes:
@ -16,7 +17,7 @@ class BodyPhotoUploadAlbumsAlbumPhotosPost:
""" """
file: File file: File
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
file = self.file.to_tuple() file = self.file.to_tuple()

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="BodyUserCreateUsersPost") T = TypeVar("T", bound="BodyUserCreateUsersPost")
@attr.s(auto_attribs=True) @_attrs_define
class BodyUserCreateUsersPost: class BodyUserCreateUsersPost:
""" """
Attributes: Attributes:
@ -17,11 +18,13 @@ class BodyUserCreateUsersPost:
user: str user: str
email: str email: str
password: str password: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
user = self.user user = self.user
email = self.email email = self.email
password = self.password password = self.password
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="BodyUserDeleteUsersMeDelete") T = TypeVar("T", bound="BodyUserDeleteUsersMeDelete")
@attr.s(auto_attribs=True) @_attrs_define
class BodyUserDeleteUsersMeDelete: class BodyUserDeleteUsersMeDelete:
""" """
Attributes: Attributes:
@ -13,7 +14,7 @@ class BodyUserDeleteUsersMeDelete:
""" """
password: str password: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
password = self.password password = self.password

View File

@ -1,14 +1,15 @@
from io import BytesIO from io import BytesIO
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import File from ..types import File
T = TypeVar("T", bound="BodyVideoUploadAlbumsAlbumVideosPost") T = TypeVar("T", bound="BodyVideoUploadAlbumsAlbumVideosPost")
@attr.s(auto_attribs=True) @_attrs_define
class BodyVideoUploadAlbumsAlbumVideosPost: class BodyVideoUploadAlbumsAlbumVideosPost:
""" """
Attributes: Attributes:
@ -16,7 +17,7 @@ class BodyVideoUploadAlbumsAlbumVideosPost:
""" """
file: File file: File
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
file = self.file.to_tuple() file = self.file.to_tuple()

View File

@ -1,6 +1,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset from ..types import UNSET, Unset
@ -11,7 +12,7 @@ if TYPE_CHECKING:
T = TypeVar("T", bound="HTTPValidationError") T = TypeVar("T", bound="HTTPValidationError")
@attr.s(auto_attribs=True) @_attrs_define
class HTTPValidationError: class HTTPValidationError:
""" """
Attributes: Attributes:
@ -19,7 +20,7 @@ class HTTPValidationError:
""" """
detail: Union[Unset, List["ValidationError"]] = UNSET detail: Union[Unset, List["ValidationError"]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
detail: Union[Unset, List[Dict[str, Any]]] = UNSET detail: Union[Unset, List[Dict[str, Any]]] = UNSET
@ -27,7 +28,6 @@ class HTTPValidationError:
detail = [] detail = []
for detail_item_data in self.detail: for detail_item_data in self.detail:
detail_item = detail_item_data.to_dict() detail_item = detail_item_data.to_dict()
detail.append(detail_item) detail.append(detail_item)
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="Photo") T = TypeVar("T", bound="Photo")
@attr.s(auto_attribs=True) @_attrs_define
class Photo: class Photo:
""" """
Attributes: Attributes:
@ -19,12 +20,15 @@ class Photo:
album: str album: str
hash_: str hash_: str
filename: str filename: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
id = self.id id = self.id
album = self.album album = self.album
hash_ = self.hash_ hash_ = self.hash_
filename = self.filename filename = self.filename
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="PhotoPublic") T = TypeVar("T", bound="PhotoPublic")
@attr.s(auto_attribs=True) @_attrs_define
class PhotoPublic: class PhotoPublic:
""" """
Attributes: Attributes:
@ -17,11 +18,13 @@ class PhotoPublic:
id: str id: str
caption: str caption: str
filename: str filename: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
id = self.id id = self.id
caption = self.caption caption = self.caption
filename = self.filename filename = self.filename
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,29 +1,31 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="PhotoSearch") T = TypeVar("T", bound="PhotoSearch")
@attr.s(auto_attribs=True) @_attrs_define
class PhotoSearch: class PhotoSearch:
""" """
Attributes: Attributes:
id (str): id (str):
filename (str): filename (str):
caption (Union[Unset, str]): caption (Union[None, str]):
""" """
id: str id: str
filename: str filename: str
caption: Union[Unset, str] = UNSET caption: Union[None, str]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
id = self.id id = self.id
filename = self.filename filename = self.filename
caption: Union[None, str]
caption = self.caption caption = self.caption
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -32,10 +34,9 @@ class PhotoSearch:
{ {
"id": id, "id": id,
"filename": filename, "filename": filename,
"caption": caption,
} }
) )
if caption is not UNSET:
field_dict["caption"] = caption
return field_dict return field_dict
@ -46,7 +47,12 @@ class PhotoSearch:
filename = d.pop("filename") filename = d.pop("filename")
caption = d.pop("caption", UNSET) def _parse_caption(data: object) -> Union[None, str]:
if data is None:
return data
return cast(Union[None, str], data)
caption = _parse_caption(d.pop("caption"))
photo_search = cls( photo_search = cls(
id=id, id=id,

View File

@ -1,6 +1,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
if TYPE_CHECKING: if TYPE_CHECKING:
from ..models.photo_search import PhotoSearch from ..models.photo_search import PhotoSearch
@ -9,7 +10,7 @@ if TYPE_CHECKING:
T = TypeVar("T", bound="RandomSearchResultsPhoto") T = TypeVar("T", bound="RandomSearchResultsPhoto")
@attr.s(auto_attribs=True) @_attrs_define
class RandomSearchResultsPhoto: class RandomSearchResultsPhoto:
""" """
Attributes: Attributes:
@ -17,13 +18,12 @@ class RandomSearchResultsPhoto:
""" """
results: List["PhotoSearch"] results: List["PhotoSearch"]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
results = [] results = []
for results_item_data in self.results: for results_item_data in self.results:
results_item = results_item_data.to_dict() results_item = results_item_data.to_dict()
results.append(results_item) results.append(results_item)
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,6 +1,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
if TYPE_CHECKING: if TYPE_CHECKING:
from ..models.video_search import VideoSearch from ..models.video_search import VideoSearch
@ -9,7 +10,7 @@ if TYPE_CHECKING:
T = TypeVar("T", bound="RandomSearchResultsVideo") T = TypeVar("T", bound="RandomSearchResultsVideo")
@attr.s(auto_attribs=True) @_attrs_define
class RandomSearchResultsVideo: class RandomSearchResultsVideo:
""" """
Attributes: Attributes:
@ -17,13 +18,12 @@ class RandomSearchResultsVideo:
""" """
results: List["VideoSearch"] results: List["VideoSearch"]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
results = [] results = []
for results_item_data in self.results: for results_item_data in self.results:
results_item = results_item_data.to_dict() results_item = results_item_data.to_dict()
results.append(results_item) results.append(results_item)
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,8 +1,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
if TYPE_CHECKING: if TYPE_CHECKING:
from ..models.album import Album from ..models.album import Album
@ -11,25 +10,25 @@ if TYPE_CHECKING:
T = TypeVar("T", bound="SearchResultsAlbum") T = TypeVar("T", bound="SearchResultsAlbum")
@attr.s(auto_attribs=True) @_attrs_define
class SearchResultsAlbum: class SearchResultsAlbum:
""" """
Attributes: Attributes:
results (List['Album']): results (List['Album']):
next_page (Union[Unset, str]): next_page (Union[None, str]):
""" """
results: List["Album"] results: List["Album"]
next_page: Union[Unset, str] = UNSET next_page: Union[None, str]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
results = [] results = []
for results_item_data in self.results: for results_item_data in self.results:
results_item = results_item_data.to_dict() results_item = results_item_data.to_dict()
results.append(results_item) results.append(results_item)
next_page: Union[None, str]
next_page = self.next_page next_page = self.next_page
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -37,10 +36,9 @@ class SearchResultsAlbum:
field_dict.update( field_dict.update(
{ {
"results": results, "results": results,
"next_page": next_page,
} }
) )
if next_page is not UNSET:
field_dict["next_page"] = next_page
return field_dict return field_dict
@ -56,7 +54,12 @@ class SearchResultsAlbum:
results.append(results_item) results.append(results_item)
next_page = d.pop("next_page", UNSET) def _parse_next_page(data: object) -> Union[None, str]:
if data is None:
return data
return cast(Union[None, str], data)
next_page = _parse_next_page(d.pop("next_page"))
search_results_album = cls( search_results_album = cls(
results=results, results=results,

View File

@ -1,8 +1,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
if TYPE_CHECKING: if TYPE_CHECKING:
from ..models.photo_search import PhotoSearch from ..models.photo_search import PhotoSearch
@ -11,25 +10,25 @@ if TYPE_CHECKING:
T = TypeVar("T", bound="SearchResultsPhoto") T = TypeVar("T", bound="SearchResultsPhoto")
@attr.s(auto_attribs=True) @_attrs_define
class SearchResultsPhoto: class SearchResultsPhoto:
""" """
Attributes: Attributes:
results (List['PhotoSearch']): results (List['PhotoSearch']):
next_page (Union[Unset, str]): next_page (Union[None, str]):
""" """
results: List["PhotoSearch"] results: List["PhotoSearch"]
next_page: Union[Unset, str] = UNSET next_page: Union[None, str]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
results = [] results = []
for results_item_data in self.results: for results_item_data in self.results:
results_item = results_item_data.to_dict() results_item = results_item_data.to_dict()
results.append(results_item) results.append(results_item)
next_page: Union[None, str]
next_page = self.next_page next_page = self.next_page
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -37,10 +36,9 @@ class SearchResultsPhoto:
field_dict.update( field_dict.update(
{ {
"results": results, "results": results,
"next_page": next_page,
} }
) )
if next_page is not UNSET:
field_dict["next_page"] = next_page
return field_dict return field_dict
@ -56,7 +54,12 @@ class SearchResultsPhoto:
results.append(results_item) results.append(results_item)
next_page = d.pop("next_page", UNSET) def _parse_next_page(data: object) -> Union[None, str]:
if data is None:
return data
return cast(Union[None, str], data)
next_page = _parse_next_page(d.pop("next_page"))
search_results_photo = cls( search_results_photo = cls(
results=results, results=results,

View File

@ -1,8 +1,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
if TYPE_CHECKING: if TYPE_CHECKING:
from ..models.video_search import VideoSearch from ..models.video_search import VideoSearch
@ -11,25 +10,25 @@ if TYPE_CHECKING:
T = TypeVar("T", bound="SearchResultsVideo") T = TypeVar("T", bound="SearchResultsVideo")
@attr.s(auto_attribs=True) @_attrs_define
class SearchResultsVideo: class SearchResultsVideo:
""" """
Attributes: Attributes:
results (List['VideoSearch']): results (List['VideoSearch']):
next_page (Union[Unset, str]): next_page (Union[None, str]):
""" """
results: List["VideoSearch"] results: List["VideoSearch"]
next_page: Union[Unset, str] = UNSET next_page: Union[None, str]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
results = [] results = []
for results_item_data in self.results: for results_item_data in self.results:
results_item = results_item_data.to_dict() results_item = results_item_data.to_dict()
results.append(results_item) results.append(results_item)
next_page: Union[None, str]
next_page = self.next_page next_page = self.next_page
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -37,10 +36,9 @@ class SearchResultsVideo:
field_dict.update( field_dict.update(
{ {
"results": results, "results": results,
"next_page": next_page,
} }
) )
if next_page is not UNSET:
field_dict["next_page"] = next_page
return field_dict return field_dict
@ -56,7 +54,12 @@ class SearchResultsVideo:
results.append(results_item) results.append(results_item)
next_page = d.pop("next_page", UNSET) def _parse_next_page(data: object) -> Union[None, str]:
if data is None:
return data
return cast(Union[None, str], data)
next_page = _parse_next_page(d.pop("next_page"))
search_results_video = cls( search_results_video = cls(
results=results, results=results,

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="Token") T = TypeVar("T", bound="Token")
@attr.s(auto_attribs=True) @_attrs_define
class Token: class Token:
""" """
Attributes: Attributes:
@ -15,10 +16,11 @@ class Token:
access_token: str access_token: str
token_type: str token_type: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
access_token = self.access_token access_token = self.access_token
token_type = self.token_type token_type = self.token_type
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,29 +1,37 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="User") T = TypeVar("T", bound="User")
@attr.s(auto_attribs=True) @_attrs_define
class User: class User:
""" """
Attributes: Attributes:
user (str): user (str):
email (Union[Unset, str]): email (Union[None, str]):
disabled (Union[Unset, bool]): quota (Union[None, int]):
disabled (Union[None, bool]):
""" """
user: str user: str
email: Union[Unset, str] = UNSET email: Union[None, str]
disabled: Union[Unset, bool] = UNSET quota: Union[None, int]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) disabled: Union[None, bool]
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
user = self.user user = self.user
email: Union[None, str]
email = self.email email = self.email
quota: Union[None, int]
quota = self.quota
disabled: Union[None, bool]
disabled = self.disabled disabled = self.disabled
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -31,12 +39,11 @@ class User:
field_dict.update( field_dict.update(
{ {
"user": user, "user": user,
"email": email,
"quota": quota,
"disabled": disabled,
} }
) )
if email is not UNSET:
field_dict["email"] = email
if disabled is not UNSET:
field_dict["disabled"] = disabled
return field_dict return field_dict
@ -45,13 +52,31 @@ class User:
d = src_dict.copy() d = src_dict.copy()
user = d.pop("user") user = d.pop("user")
email = d.pop("email", UNSET) def _parse_email(data: object) -> Union[None, str]:
if data is None:
return data
return cast(Union[None, str], data)
disabled = d.pop("disabled", UNSET) email = _parse_email(d.pop("email"))
def _parse_quota(data: object) -> Union[None, int]:
if data is None:
return data
return cast(Union[None, int], data)
quota = _parse_quota(d.pop("quota"))
def _parse_disabled(data: object) -> Union[None, bool]:
if data is None:
return data
return cast(Union[None, bool], data)
disabled = _parse_disabled(d.pop("disabled"))
user = cls( user = cls(
user=user, user=user,
email=email, email=email,
quota=quota,
disabled=disabled, disabled=disabled,
) )

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="ValidationError") T = TypeVar("T", bound="ValidationError")
@attr.s(auto_attribs=True) @_attrs_define
class ValidationError: class ValidationError:
""" """
Attributes: Attributes:
@ -17,18 +18,17 @@ class ValidationError:
loc: List[Union[int, str]] loc: List[Union[int, str]]
msg: str msg: str
type: str type: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
loc = [] loc = []
for loc_item_data in self.loc: for loc_item_data in self.loc:
loc_item: Union[int, str] loc_item: Union[int, str]
loc_item = loc_item_data loc_item = loc_item_data
loc.append(loc_item) loc.append(loc_item)
msg = self.msg msg = self.msg
type = self.type type = self.type
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="Video") T = TypeVar("T", bound="Video")
@attr.s(auto_attribs=True) @_attrs_define
class Video: class Video:
""" """
Attributes: Attributes:
@ -19,12 +20,15 @@ class Video:
album: str album: str
hash_: str hash_: str
filename: str filename: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
id = self.id id = self.id
album = self.album album = self.album
hash_ = self.hash_ hash_ = self.hash_
filename = self.filename filename = self.filename
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,11 +1,12 @@
from typing import Any, Dict, List, Type, TypeVar from typing import Any, Dict, List, Type, TypeVar
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
T = TypeVar("T", bound="VideoPublic") T = TypeVar("T", bound="VideoPublic")
@attr.s(auto_attribs=True) @_attrs_define
class VideoPublic: class VideoPublic:
""" """
Attributes: Attributes:
@ -17,11 +18,13 @@ class VideoPublic:
id: str id: str
caption: str caption: str
filename: str filename: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
id = self.id id = self.id
caption = self.caption caption = self.caption
filename = self.filename filename = self.filename
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}

View File

@ -1,29 +1,31 @@
from typing import Any, Dict, List, Type, TypeVar, Union from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="VideoSearch") T = TypeVar("T", bound="VideoSearch")
@attr.s(auto_attribs=True) @_attrs_define
class VideoSearch: class VideoSearch:
""" """
Attributes: Attributes:
id (str): id (str):
filename (str): filename (str):
caption (Union[Unset, str]): caption (Union[None, str]):
""" """
id: str id: str
filename: str filename: str
caption: Union[Unset, str] = UNSET caption: Union[None, str]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
id = self.id id = self.id
filename = self.filename filename = self.filename
caption: Union[None, str]
caption = self.caption caption = self.caption
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
@ -32,10 +34,9 @@ class VideoSearch:
{ {
"id": id, "id": id,
"filename": filename, "filename": filename,
"caption": caption,
} }
) )
if caption is not UNSET:
field_dict["caption"] = caption
return field_dict return field_dict
@ -46,7 +47,12 @@ class VideoSearch:
filename = d.pop("filename") filename = d.pop("filename")
caption = d.pop("caption", UNSET) def _parse_caption(data: object) -> Union[None, str]:
if data is None:
return data
return cast(Union[None, str], data)
caption = _parse_caption(d.pop("caption"))
video_search = cls( video_search = cls(
id=id, id=id,

View File

@ -1,8 +1,9 @@
""" Contains some shared types for properties """ """ Contains some shared types for properties """
from http import HTTPStatus from http import HTTPStatus
from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar
import attr from attrs import define
class Unset: class Unset:
@ -15,7 +16,7 @@ UNSET: Unset = Unset()
FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]] FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]]
@attr.s(auto_attribs=True) @define
class File: class File:
"""Contains information for file uploads""" """Contains information for file uploads"""
@ -31,7 +32,7 @@ class File:
T = TypeVar("T") T = TypeVar("T")
@attr.s(auto_attribs=True) @define
class Response(Generic[T]): class Response(Generic[T]):
"""A response from an endpoint""" """A response from an endpoint"""
@ -41,4 +42,4 @@ class Response(Generic[T]):
parsed: Optional[T] parsed: Optional[T]
__all__ = ["File", "Response", "FileJsonType"] __all__ = ["File", "Response", "FileJsonType", "Unset", "UNSET"]

View File

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

5
requirements.txt Normal file
View File

@ -0,0 +1,5 @@
autoflake~=2.3.0
black~=24.2.0
build~=1.1.1
isort~=5.13.2
openapi-python-client==0.19.0