Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
4195edfcd2 | |||
d76107222b | |||
99a19a3688 | |||
35aa61a83a | |||
3ab55ca96f |
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,4 +21,5 @@ dmypy.json
|
||||
|
||||
/coverage.xml
|
||||
/.coverage
|
||||
.vscode
|
||||
.vscode/*
|
||||
!.vscode/tasks.json
|
53
.vscode/tasks.json
vendored
Normal file
53
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
// 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": "bash",
|
||||
"args": [
|
||||
"./.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": "bash",
|
||||
"args": [
|
||||
"./.venv/bin/activate && ./.venv/bin/openapi-python-client generate --config ./config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
|
||||
]
|
||||
},
|
||||
"windows": {
|
||||
"command": ".\\.venv\\Scripts\\activate.ps1; .\\.venv\\Scripts\\openapi-python-client generate --config .\\config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Update",
|
||||
"type": "shell",
|
||||
"linux": {
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"./.venv/bin/activate && ./.venv/bin/openapi-python-client update --config ./config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
|
||||
]
|
||||
},
|
||||
"windows": {
|
||||
"command": ".\\.venv\\Scripts\\activate.ps1; .\\.venv\\Scripts\\openapi-python-client update --config .\\config.yaml --url \"https://photos.end-play.xyz/openapi.json\""
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
23
PhotosAPI_Client/.gitignore
vendored
Normal file
23
PhotosAPI_Client/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
__pycache__/
|
||||
build/
|
||||
dist/
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# JetBrains
|
||||
.idea/
|
||||
|
||||
/coverage.xml
|
||||
/.coverage
|
78
PhotosAPI_Client/README.md
Normal file
78
PhotosAPI_Client/README.md
Normal file
@ -0,0 +1,78 @@
|
||||
# PhotosAPI_Client
|
||||
|
||||
A client library for accessing Photos API
|
||||
|
||||
## Usage
|
||||
|
||||
First, create a client:
|
||||
|
||||
```python
|
||||
from photosapi_client import Client
|
||||
|
||||
client = Client(base_url="https://api.example.com")
|
||||
```
|
||||
|
||||
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
||||
|
||||
```python
|
||||
from photosapi_client import AuthenticatedClient
|
||||
|
||||
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
||||
```
|
||||
|
||||
Now call your endpoint and use your models:
|
||||
|
||||
```python
|
||||
from photosapi_client.models import MyDataModel
|
||||
from photosapi_client.api.my_tag import get_my_data_model
|
||||
from photosapi_client.types import Response
|
||||
|
||||
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
||||
# or if you need more info (e.g. status_code)
|
||||
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
||||
```
|
||||
|
||||
Or do the same thing with an async version:
|
||||
|
||||
```python
|
||||
from photosapi_client.models import MyDataModel
|
||||
from photosapi_client.api.my_tag import get_my_data_model
|
||||
from photosapi_client.types import Response
|
||||
|
||||
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
||||
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
||||
```
|
||||
|
||||
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
||||
|
||||
```python
|
||||
client = AuthenticatedClient(
|
||||
base_url="https://internal_api.example.com",
|
||||
token="SuperSecretToken",
|
||||
verify_ssl="/path/to/certificate_bundle.pem",
|
||||
)
|
||||
```
|
||||
|
||||
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
||||
|
||||
```python
|
||||
client = AuthenticatedClient(
|
||||
base_url="https://internal_api.example.com",
|
||||
token="SuperSecretToken",
|
||||
verify_ssl=False
|
||||
)
|
||||
```
|
||||
|
||||
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info.
|
||||
|
||||
Things to know:
|
||||
|
||||
1. Every path/method combo becomes a Python module with four functions:
|
||||
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
||||
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
||||
1. `asyncio`: Like `sync` but async instead of blocking
|
||||
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
||||
|
||||
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. Any endpoint which did not have a tag will be in `photosapi_client.api.default`
|
@ -1,4 +1,5 @@
|
||||
""" A client library for accessing END PLAY Photos """
|
||||
|
||||
from .client import AuthenticatedClient, Client
|
||||
|
||||
__all__ = (
|
@ -12,34 +12,30 @@ from ...types import UNSET, Response
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
) -> 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["name"] = name
|
||||
|
||||
params["title"] = title
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums",
|
||||
"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:
|
||||
response_200 = Album.from_dict(response.json())
|
||||
|
||||
@ -60,7 +56,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -92,13 +90,11 @@ def sync_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -157,13 +153,11 @@ async def asyncio_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -11,25 +11,21 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/album/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/album/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
}
|
||||
|
||||
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:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
@ -46,7 +42,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -77,11 +75,9 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -136,11 +132,9 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -12,32 +12,26 @@ from ...types import UNSET, Response
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: str,
|
||||
) -> 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["q"] = q
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = SearchResultsAlbum.from_dict(response.json())
|
||||
@ -54,7 +48,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -85,12 +79,10 @@ def sync_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
q=q,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -144,12 +136,10 @@ async def asyncio_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
q=q,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -13,38 +13,49 @@ from ...types import UNSET, Response, Unset
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
name: Union[None, Unset, str] = UNSET,
|
||||
title: Union[None, Unset, str] = UNSET,
|
||||
cover: Union[None, Unset, str] = UNSET,
|
||||
) -> 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["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}
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "patch",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = AlbumModified.from_dict(response.json())
|
||||
@ -67,7 +78,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -81,9 +92,9 @@ def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
name: Union[None, Unset, str] = UNSET,
|
||||
title: Union[None, Unset, str] = UNSET,
|
||||
cover: Union[None, Unset, str] = UNSET,
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Patch
|
||||
|
||||
@ -91,9 +102,9 @@ def sync_detailed(
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (Union[Unset, None, str]):
|
||||
title (Union[Unset, None, str]):
|
||||
cover (Union[Unset, None, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
title (Union[None, Unset, str]):
|
||||
cover (Union[None, Unset, str]):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -123,9 +132,9 @@ def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
name: Union[None, Unset, str] = UNSET,
|
||||
title: Union[None, Unset, str] = UNSET,
|
||||
cover: Union[None, Unset, str] = UNSET,
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Patch
|
||||
|
||||
@ -133,9 +142,9 @@ def sync(
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (Union[Unset, None, str]):
|
||||
title (Union[Unset, None, str]):
|
||||
cover (Union[Unset, None, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
title (Union[None, Unset, str]):
|
||||
cover (Union[None, Unset, str]):
|
||||
|
||||
Raises:
|
||||
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,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
name: Union[None, Unset, str] = UNSET,
|
||||
title: Union[None, Unset, str] = UNSET,
|
||||
cover: Union[None, Unset, str] = UNSET,
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Patch
|
||||
|
||||
@ -168,9 +177,9 @@ async def asyncio_detailed(
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (Union[Unset, None, str]):
|
||||
title (Union[Unset, None, str]):
|
||||
cover (Union[Unset, None, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
title (Union[None, Unset, str]):
|
||||
cover (Union[None, Unset, str]):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -198,9 +205,9 @@ async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
name: Union[None, Unset, str] = UNSET,
|
||||
title: Union[None, Unset, str] = UNSET,
|
||||
cover: Union[None, Unset, str] = UNSET,
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Patch
|
||||
|
||||
@ -208,9 +215,9 @@ async def asyncio(
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (Union[Unset, None, str]):
|
||||
title (Union[Unset, None, str]):
|
||||
cover (Union[Unset, None, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
title (Union[None, Unset, str]):
|
||||
cover (Union[None, Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@ -13,17 +13,13 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
cover: str,
|
||||
) -> 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["name"] = name
|
||||
|
||||
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}
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = AlbumModified.from_dict(response.json())
|
||||
@ -67,7 +63,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -105,14 +101,12 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -182,14 +176,12 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
|
||||
import httpx
|
||||
|
||||
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.http_validation_error import HTTPValidationError
|
||||
from ...models.token import Token
|
||||
@ -13,26 +13,27 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
body: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/token".format(client.base_url)
|
||||
headers: Dict[str, Any] = {}
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"data": form_data.to_dict(),
|
||||
"url": "/token",
|
||||
}
|
||||
|
||||
_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:
|
||||
response_200 = Token.from_dict(response.json())
|
||||
|
||||
@ -50,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -61,11 +64,14 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Response[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
Args:
|
||||
body (BodyLoginForAccessTokenTokenPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -75,12 +81,10 @@ def sync_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -89,11 +93,14 @@ def sync_detailed(
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
Args:
|
||||
body (BodyLoginForAccessTokenTokenPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -104,17 +111,20 @@ def sync(
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Response[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
Args:
|
||||
body (BodyLoginForAccessTokenTokenPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -124,23 +134,24 @@ async def asyncio_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
Args:
|
||||
body (BodyLoginForAccessTokenTokenPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -152,6 +163,6 @@ async def asyncio(
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
@ -11,25 +11,21 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> 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()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/photos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
}
|
||||
|
||||
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:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
@ -46,7 +42,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -77,11 +75,9 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -136,11 +132,9 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -12,52 +12,80 @@ from ...types import UNSET, Response, Unset
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
lng: Union[Unset, None, float] = UNSET,
|
||||
radius: Union[Unset, None, int] = UNSET,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
lat: Union[None, Unset, float] = UNSET,
|
||||
lng: Union[None, Unset, float] = UNSET,
|
||||
radius: Union[None, Unset, int] = UNSET,
|
||||
) -> 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["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_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}
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums/{album}/photos".format(
|
||||
album=album,
|
||||
),
|
||||
"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:
|
||||
response_200 = SearchResultsPhoto.from_dict(response.json())
|
||||
|
||||
@ -80,7 +108,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -93,14 +123,14 @@ def sync_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
lng: Union[Unset, None, float] = UNSET,
|
||||
radius: Union[Unset, None, int] = UNSET,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
lat: Union[None, Unset, float] = UNSET,
|
||||
lng: Union[None, Unset, float] = UNSET,
|
||||
radius: Union[None, Unset, int] = UNSET,
|
||||
) -> Response[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
@ -108,14 +138,14 @@ def sync_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
lng (Union[Unset, None, float]):
|
||||
radius (Union[Unset, None, int]):
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
lat (Union[None, Unset, float]):
|
||||
lng (Union[None, Unset, float]):
|
||||
radius (Union[None, Unset, int]):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
@ -138,8 +167,7 @@ def sync_detailed(
|
||||
radius=radius,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -150,14 +178,14 @@ def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
lng: Union[Unset, None, float] = UNSET,
|
||||
radius: Union[Unset, None, int] = UNSET,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
lat: Union[None, Unset, float] = UNSET,
|
||||
lng: Union[None, Unset, float] = UNSET,
|
||||
radius: Union[None, Unset, int] = UNSET,
|
||||
) -> Optional[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
@ -165,14 +193,14 @@ def sync(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
lng (Union[Unset, None, float]):
|
||||
radius (Union[Unset, None, int]):
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
lat (Union[None, Unset, float]):
|
||||
lng (Union[None, Unset, float]):
|
||||
radius (Union[None, Unset, int]):
|
||||
|
||||
Raises:
|
||||
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,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
lng: Union[Unset, None, float] = UNSET,
|
||||
radius: Union[Unset, None, int] = UNSET,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
lat: Union[None, Unset, float] = UNSET,
|
||||
lng: Union[None, Unset, float] = UNSET,
|
||||
radius: Union[None, Unset, int] = UNSET,
|
||||
) -> Response[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
@ -215,14 +243,14 @@ async def asyncio_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
lng (Union[Unset, None, float]):
|
||||
radius (Union[Unset, None, int]):
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
lat (Union[None, Unset, float]):
|
||||
lng (Union[None, Unset, float]):
|
||||
radius (Union[None, Unset, int]):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
@ -245,8 +272,7 @@ async def asyncio_detailed(
|
||||
radius=radius,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -255,14 +281,14 @@ async def asyncio(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
lng: Union[Unset, None, float] = UNSET,
|
||||
radius: Union[Unset, None, int] = UNSET,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
lat: Union[None, Unset, float] = UNSET,
|
||||
lng: Union[None, Unset, float] = UNSET,
|
||||
radius: Union[None, Unset, int] = UNSET,
|
||||
) -> Optional[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
@ -270,14 +296,14 @@ async def asyncio(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
lng (Union[Unset, None, float]):
|
||||
radius (Union[Unset, None, int]):
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
lat (Union[None, Unset, float]):
|
||||
lng (Union[None, Unset, float]):
|
||||
radius (Union[None, Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@ -12,25 +12,21 @@ from ...types import File, Response
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> 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()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/photos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
}
|
||||
|
||||
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:
|
||||
response_200 = File(payload=BytesIO(response.content))
|
||||
|
||||
@ -48,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -79,11 +77,9 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -138,11 +134,9 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
@ -12,33 +12,31 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
id: int,
|
||||
) -> 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["id"] = id
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/token/photo/{token}".format(
|
||||
token=token,
|
||||
),
|
||||
"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:
|
||||
response_200 = cast(Any, response.json())
|
||||
response_200 = response.json()
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
response_401 = cast(Any, None)
|
||||
@ -56,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -68,7 +68,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
|
||||
def sync_detailed(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
id: int,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
||||
@ -89,12 +89,10 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
token=token,
|
||||
client=client,
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -104,7 +102,7 @@ def sync_detailed(
|
||||
def sync(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
id: int,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
||||
@ -133,7 +131,7 @@ def sync(
|
||||
async def asyncio_detailed(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
id: int,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
||||
@ -154,12 +152,10 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
token=token,
|
||||
client=client,
|
||||
id=id,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -167,7 +163,7 @@ async def asyncio_detailed(
|
||||
async def asyncio(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
id: int,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
@ -13,32 +13,28 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> 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["album"] = album
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/photos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PhotoPublic.from_dict(response.json())
|
||||
@ -58,7 +54,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -92,12 +88,10 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -157,12 +151,10 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -13,32 +13,28 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> 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["caption"] = caption
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/photos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PhotoPublic.from_dict(response.json())
|
||||
@ -58,7 +54,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -92,12 +88,10 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -157,12 +151,10 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -13,35 +13,36 @@ from ...types import UNSET, Response, Unset
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> 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["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 = {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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums/{album}/photos/random".format(
|
||||
album=album,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = RandomSearchResultsPhoto.from_dict(response.json())
|
||||
@ -64,7 +65,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -78,8 +79,8 @@ def sync_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
|
||||
"""Photo Random
|
||||
|
||||
@ -87,8 +88,8 @@ def sync_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
caption=caption,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -117,8 +116,8 @@ def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
|
||||
"""Photo Random
|
||||
|
||||
@ -126,8 +125,8 @@ def sync(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
|
||||
"""Photo Random
|
||||
|
||||
@ -158,8 +157,8 @@ async def asyncio_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
caption=caption,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -186,8 +183,8 @@ async def asyncio(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
|
||||
"""Photo Random
|
||||
|
||||
@ -195,8 +192,8 @@ async def asyncio(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@ -14,45 +14,54 @@ from ...types import UNSET, Response, Unset
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, bool] = False,
|
||||
compress: Union[Unset, bool] = True,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> 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()
|
||||
headers: Dict[str, Any] = {}
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["ignore_duplicates"] = ignore_duplicates
|
||||
|
||||
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}
|
||||
|
||||
multipart_multipart_data = multipart_data.to_multipart()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"files": multipart_multipart_data,
|
||||
"url": "/albums/{album}/photos".format(
|
||||
album=album,
|
||||
),
|
||||
"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:
|
||||
response_200 = Photo.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.FORBIDDEN:
|
||||
response_403 = cast(Any, None)
|
||||
return response_403
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
@ -69,7 +78,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -82,10 +93,10 @@ def sync_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, bool] = False,
|
||||
compress: Union[Unset, bool] = True,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, HTTPValidationError, Photo]]:
|
||||
"""Photo Upload
|
||||
|
||||
@ -93,10 +104,10 @@ def sync_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
ignore_duplicates (Union[Unset, None, bool]):
|
||||
compress (Union[Unset, None, bool]): Default: True.
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
ignore_duplicates (Union[Unset, bool]): Default: False.
|
||||
compress (Union[Unset, bool]): Default: True.
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -127,10 +136,10 @@ def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, bool] = False,
|
||||
compress: Union[Unset, bool] = True,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Photo]]:
|
||||
"""Photo Upload
|
||||
|
||||
@ -138,10 +147,10 @@ def sync(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
ignore_duplicates (Union[Unset, None, bool]):
|
||||
compress (Union[Unset, None, bool]): Default: True.
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
ignore_duplicates (Union[Unset, bool]): Default: False.
|
||||
compress (Union[Unset, bool]): Default: True.
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
||||
@ -165,10 +174,10 @@ async def asyncio_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, bool] = False,
|
||||
compress: Union[Unset, bool] = True,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, HTTPValidationError, Photo]]:
|
||||
"""Photo Upload
|
||||
|
||||
@ -176,10 +185,10 @@ async def asyncio_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
ignore_duplicates (Union[Unset, None, bool]):
|
||||
compress (Union[Unset, None, bool]): Default: True.
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
ignore_duplicates (Union[Unset, bool]): Default: False.
|
||||
compress (Union[Unset, bool]): Default: True.
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -208,10 +215,10 @@ async def asyncio(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, bool] = False,
|
||||
compress: Union[Unset, bool] = True,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Photo]]:
|
||||
"""Photo Upload
|
||||
|
||||
@ -219,10 +226,10 @@ async def asyncio(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
ignore_duplicates (Union[Unset, None, bool]):
|
||||
compress (Union[Unset, None, bool]): Default: True.
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
ignore_duplicates (Union[Unset, bool]): Default: False.
|
||||
compress (Union[Unset, bool]): Default: True.
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyPhotoUploadAlbumsAlbumPhotosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
@ -12,33 +12,31 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> 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["code"] = code
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/users/{user}/confirm".format(
|
||||
user=user,
|
||||
),
|
||||
"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:
|
||||
response_200 = cast(Any, response.json())
|
||||
response_200 = response.json()
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
@ -53,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -65,7 +65,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
|
||||
def sync_detailed(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
@ -84,12 +84,10 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -99,7 +97,7 @@ def sync_detailed(
|
||||
def sync(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
@ -126,7 +124,7 @@ def sync(
|
||||
async def asyncio_detailed(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
@ -145,12 +143,10 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -158,7 +154,7 @@ async def asyncio_detailed(
|
||||
async def asyncio(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
@ -12,33 +12,31 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> 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["code"] = code
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/users/{user}/confirm".format(
|
||||
user=user,
|
||||
),
|
||||
"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:
|
||||
response_200 = cast(Any, response.json())
|
||||
response_200 = response.json()
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
@ -53,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -65,7 +65,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
|
||||
def sync_detailed(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
@ -84,12 +84,10 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -99,7 +97,7 @@ def sync_detailed(
|
||||
def sync(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
@ -126,7 +124,7 @@ def sync(
|
||||
async def asyncio_detailed(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
@ -145,12 +143,10 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -158,7 +154,7 @@ async def asyncio_detailed(
|
||||
async def asyncio(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.body_user_create_users_post import BodyUserCreateUsersPost
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
@ -12,26 +12,27 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
body: BodyUserCreateUsersPost,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users".format(client.base_url)
|
||||
headers: Dict[str, Any] = {}
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"data": form_data.to_dict(),
|
||||
"url": "/users",
|
||||
}
|
||||
|
||||
_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:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
@ -48,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -59,11 +62,14 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUserCreateUsersPost,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
Args:
|
||||
body (BodyUserCreateUsersPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -73,12 +79,10 @@ def sync_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -87,11 +91,14 @@ def sync_detailed(
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUserCreateUsersPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
Args:
|
||||
body (BodyUserCreateUsersPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -102,17 +109,20 @@ def sync(
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUserCreateUsersPost,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
Args:
|
||||
body (BodyUserCreateUsersPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -122,23 +132,24 @@ async def asyncio_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUserCreateUsersPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
Args:
|
||||
body (BodyUserCreateUsersPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -150,6 +161,6 @@ async def asyncio(
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
@ -12,26 +12,27 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
body: BodyUserDeleteUsersMeDelete,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/me/".format(client.base_url)
|
||||
headers: Dict[str, Any] = {}
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"data": form_data.to_dict(),
|
||||
"url": "/users/me/",
|
||||
}
|
||||
|
||||
_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:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
@ -48,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -60,10 +63,13 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
body: BodyUserDeleteUsersMeDelete,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
Args:
|
||||
body (BodyUserDeleteUsersMeDelete):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -73,12 +79,10 @@ def sync_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -88,10 +92,13 @@ def sync_detailed(
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
body: BodyUserDeleteUsersMeDelete,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
Args:
|
||||
body (BodyUserDeleteUsersMeDelete):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -102,17 +109,20 @@ def sync(
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
body: BodyUserDeleteUsersMeDelete,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
Args:
|
||||
body (BodyUserDeleteUsersMeDelete):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -122,12 +132,10 @@ async def asyncio_detailed(
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -135,10 +143,13 @@ async def asyncio_detailed(
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
body: BodyUserDeleteUsersMeDelete,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
Args:
|
||||
body (BodyUserDeleteUsersMeDelete):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
@ -150,6 +161,6 @@ async def asyncio(
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
@ -1,5 +1,5 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
@ -9,26 +9,17 @@ from ...models.user import User
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/me/".format(client.base_url)
|
||||
def _get_kwargs() -> Dict[str, Any]:
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/users/me/",
|
||||
}
|
||||
|
||||
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:
|
||||
response_200 = User.from_dict(response.json())
|
||||
|
||||
@ -39,7 +30,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Use
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -62,12 +53,9 @@ def sync_detailed(
|
||||
Response[User]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -107,12 +95,9 @@ async def asyncio_detailed(
|
||||
Response[User]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -11,25 +11,21 @@ from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> 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()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/videos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
}
|
||||
|
||||
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:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
@ -46,7 +42,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -77,11 +75,9 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -136,11 +132,9 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -12,24 +12,35 @@ from ...types import UNSET, Response, Unset
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
) -> 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["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
|
||||
|
||||
@ -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}
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums/{album}/videos".format(
|
||||
album=album,
|
||||
),
|
||||
"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:
|
||||
response_200 = SearchResultsVideo.from_dict(response.json())
|
||||
|
||||
@ -71,7 +84,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -84,11 +99,11 @@ def sync_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
) -> Response[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
@ -96,11 +111,11 @@ def sync_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
@ -120,8 +134,7 @@ def sync_detailed(
|
||||
page_size=page_size,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -132,11 +145,11 @@ def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
@ -144,11 +157,11 @@ def sync(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
) -> Response[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
@ -185,11 +198,11 @@ async def asyncio_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
@ -209,8 +221,7 @@ async def asyncio_detailed(
|
||||
page_size=page_size,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -219,11 +230,11 @@ async def asyncio(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
q: Union[None, Unset, str] = UNSET,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
token: Union[None, Unset, str] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
page_size: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
@ -231,11 +242,11 @@ async def asyncio(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
q (Union[None, Unset, str]):
|
||||
caption (Union[None, Unset, str]):
|
||||
token (Union[None, Unset, str]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
page_size (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@ -12,25 +12,21 @@ from ...types import File, Response
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> 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()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/videos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
}
|
||||
|
||||
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:
|
||||
response_200 = File(payload=BytesIO(response.content))
|
||||
|
||||
@ -48,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -79,11 +77,9 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -138,11 +134,9 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -13,32 +13,28 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> 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["album"] = album
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/videos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = VideoPublic.from_dict(response.json())
|
||||
@ -58,7 +54,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -92,12 +88,10 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -157,12 +151,10 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -13,32 +13,28 @@ from ...types import UNSET, Response
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> 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["caption"] = caption
|
||||
|
||||
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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/videos/{id}".format(
|
||||
id=id,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = VideoPublic.from_dict(response.json())
|
||||
@ -58,7 +54,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -92,12 +88,10 @@ def sync_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -157,12 +151,10 @@ async def asyncio_detailed(
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
@ -13,35 +13,36 @@ from ...types import UNSET, Response, Unset
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> 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["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 = {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",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"url": "/albums/{album}/videos/random".format(
|
||||
album=album,
|
||||
),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = RandomSearchResultsVideo.from_dict(response.json())
|
||||
@ -64,7 +65,7 @@ def _parse_response(
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
@ -78,8 +79,8 @@ def sync_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
|
||||
"""Video Random
|
||||
|
||||
@ -87,8 +88,8 @@ def sync_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
caption=caption,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -117,8 +116,8 @@ def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
|
||||
"""Video Random
|
||||
|
||||
@ -126,8 +125,8 @@ def sync(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
|
||||
"""Video Random
|
||||
|
||||
@ -158,8 +157,8 @@ async def asyncio_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
caption=caption,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -186,8 +183,8 @@ async def asyncio(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
limit: Union[Unset, None, int] = 100,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsVideo]]:
|
||||
"""Video Random
|
||||
|
||||
@ -195,8 +192,8 @@ async def asyncio(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
limit (Union[Unset, None, int]): Default: 100.
|
||||
caption (Union[None, Unset, str]):
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@ -14,39 +14,48 @@ from ...types import UNSET, Response, Unset
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> 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()
|
||||
headers: 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}
|
||||
|
||||
multipart_multipart_data = multipart_data.to_multipart()
|
||||
|
||||
return {
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"files": multipart_multipart_data,
|
||||
"url": "/albums/{album}/videos".format(
|
||||
album=album,
|
||||
),
|
||||
"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:
|
||||
response_200 = Video.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.FORBIDDEN:
|
||||
response_403 = cast(Any, None)
|
||||
return response_403
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
@ -60,7 +69,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
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(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
@ -73,8 +84,8 @@ def sync_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
@ -82,8 +93,8 @@ def sync_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
@ -112,8 +121,8 @@ def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
@ -121,8 +130,8 @@ def sync(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
caption=caption,
|
||||
).parsed
|
||||
|
||||
@ -144,8 +153,8 @@ async def asyncio_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
@ -153,8 +162,8 @@ async def asyncio_detailed(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
@ -181,8 +188,8 @@ async def asyncio(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
body: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[None, Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
@ -190,8 +197,8 @@ async def asyncio(
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
caption (Union[Unset, None, str]):
|
||||
multipart_data (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
caption (Union[None, Unset, str]):
|
||||
body (BodyVideoUploadAlbumsAlbumVideosPost):
|
||||
|
||||
Raises:
|
||||
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(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
body=body,
|
||||
caption=caption,
|
||||
)
|
||||
).parsed
|
268
PhotosAPI_Client/photosapi_client/client.py
Normal file
268
PhotosAPI_Client/photosapi_client/client.py
Normal file
@ -0,0 +1,268 @@
|
||||
import ssl
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
from attrs import define, evolve, field
|
||||
|
||||
|
||||
@define
|
||||
class Client:
|
||||
"""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:
|
||||
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.
|
||||
"""
|
||||
|
||||
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)
|
||||
|
||||
def with_headers(self, headers: Dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
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]) -> "Client":
|
||||
"""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) -> "Client":
|
||||
"""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) -> "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)
|
||||
|
||||
|
||||
@define
|
||||
class AuthenticatedClient:
|
||||
"""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
|
||||
prefix: str = "Bearer"
|
||||
auth_header_name: str = "Authorization"
|
||||
|
||||
def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
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)
|
@ -8,7 +8,9 @@ class UnexpectedStatus(Exception):
|
||||
self.status_code = status_code
|
||||
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"]
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class Album:
|
||||
"""
|
||||
Attributes:
|
||||
@ -17,11 +18,13 @@ class Album:
|
||||
id: str
|
||||
name: 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]:
|
||||
id = self.id
|
||||
|
||||
name = self.name
|
||||
|
||||
title = self.title
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -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 ..types import UNSET, Unset
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AlbumModified")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class AlbumModified:
|
||||
"""
|
||||
Attributes:
|
||||
name (str):
|
||||
title (str):
|
||||
cover (Union[Unset, str]):
|
||||
cover (Union[None, str]):
|
||||
"""
|
||||
|
||||
name: str
|
||||
title: str
|
||||
cover: Union[Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
cover: Union[None, str]
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
name = self.name
|
||||
|
||||
title = self.title
|
||||
|
||||
cover: Union[None, str]
|
||||
cover = self.cover
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
@ -32,10 +34,9 @@ class AlbumModified:
|
||||
{
|
||||
"name": name,
|
||||
"title": title,
|
||||
"cover": cover,
|
||||
}
|
||||
)
|
||||
if cover is not UNSET:
|
||||
field_dict["cover"] = cover
|
||||
|
||||
return field_dict
|
||||
|
||||
@ -46,7 +47,12 @@ class AlbumModified:
|
||||
|
||||
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(
|
||||
name=name,
|
@ -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
|
||||
|
||||
T = TypeVar("T", bound="BodyLoginForAccessTokenTokenPost")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class BodyLoginForAccessTokenTokenPost:
|
||||
"""
|
||||
Attributes:
|
||||
username (str):
|
||||
password (str):
|
||||
grant_type (Union[Unset, str]):
|
||||
grant_type (Union[None, Unset, str]):
|
||||
scope (Union[Unset, str]): Default: ''.
|
||||
client_id (Union[Unset, str]):
|
||||
client_secret (Union[Unset, str]):
|
||||
client_id (Union[None, Unset, str]):
|
||||
client_secret (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
username: str
|
||||
password: str
|
||||
grant_type: Union[Unset, str] = UNSET
|
||||
grant_type: Union[None, Unset, str] = UNSET
|
||||
scope: Union[Unset, str] = ""
|
||||
client_id: Union[Unset, str] = UNSET
|
||||
client_secret: Union[Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
client_id: Union[None, Unset, str] = UNSET
|
||||
client_secret: Union[None, Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
username = self.username
|
||||
|
||||
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
|
||||
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.update(self.additional_properties)
|
||||
@ -61,13 +79,34 @@ class BodyLoginForAccessTokenTokenPost:
|
||||
|
||||
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)
|
||||
|
||||
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(
|
||||
username=username,
|
@ -1,14 +1,15 @@
|
||||
from io import BytesIO
|
||||
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
|
||||
|
||||
T = TypeVar("T", bound="BodyPhotoUploadAlbumsAlbumPhotosPost")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class BodyPhotoUploadAlbumsAlbumPhotosPost:
|
||||
"""
|
||||
Attributes:
|
||||
@ -16,7 +17,7 @@ class BodyPhotoUploadAlbumsAlbumPhotosPost:
|
||||
"""
|
||||
|
||||
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]:
|
||||
file = self.file.to_tuple()
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class BodyUserCreateUsersPost:
|
||||
"""
|
||||
Attributes:
|
||||
@ -17,11 +18,13 @@ class BodyUserCreateUsersPost:
|
||||
user: str
|
||||
email: 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]:
|
||||
user = self.user
|
||||
|
||||
email = self.email
|
||||
|
||||
password = self.password
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class BodyUserDeleteUsersMeDelete:
|
||||
"""
|
||||
Attributes:
|
||||
@ -13,7 +14,7 @@ class BodyUserDeleteUsersMeDelete:
|
||||
"""
|
||||
|
||||
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]:
|
||||
password = self.password
|
@ -1,14 +1,15 @@
|
||||
from io import BytesIO
|
||||
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
|
||||
|
||||
T = TypeVar("T", bound="BodyVideoUploadAlbumsAlbumVideosPost")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class BodyVideoUploadAlbumsAlbumVideosPost:
|
||||
"""
|
||||
Attributes:
|
||||
@ -16,7 +17,7 @@ class BodyVideoUploadAlbumsAlbumVideosPost:
|
||||
"""
|
||||
|
||||
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]:
|
||||
file = self.file.to_tuple()
|
@ -1,6 +1,7 @@
|
||||
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
|
||||
|
||||
@ -11,7 +12,7 @@ if TYPE_CHECKING:
|
||||
T = TypeVar("T", bound="HTTPValidationError")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class HTTPValidationError:
|
||||
"""
|
||||
Attributes:
|
||||
@ -19,7 +20,7 @@ class HTTPValidationError:
|
||||
"""
|
||||
|
||||
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]:
|
||||
detail: Union[Unset, List[Dict[str, Any]]] = UNSET
|
||||
@ -27,7 +28,6 @@ class HTTPValidationError:
|
||||
detail = []
|
||||
for detail_item_data in self.detail:
|
||||
detail_item = detail_item_data.to_dict()
|
||||
|
||||
detail.append(detail_item)
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class Photo:
|
||||
"""
|
||||
Attributes:
|
||||
@ -19,12 +20,15 @@ class Photo:
|
||||
album: str
|
||||
hash_: 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]:
|
||||
id = self.id
|
||||
|
||||
album = self.album
|
||||
|
||||
hash_ = self.hash_
|
||||
|
||||
filename = self.filename
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class PhotoPublic:
|
||||
"""
|
||||
Attributes:
|
||||
@ -17,11 +18,13 @@ class PhotoPublic:
|
||||
id: str
|
||||
caption: 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]:
|
||||
id = self.id
|
||||
|
||||
caption = self.caption
|
||||
|
||||
filename = self.filename
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -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 ..types import UNSET, Unset
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="PhotoSearch")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class PhotoSearch:
|
||||
"""
|
||||
Attributes:
|
||||
id (str):
|
||||
filename (str):
|
||||
caption (Union[Unset, str]):
|
||||
caption (Union[None, str]):
|
||||
"""
|
||||
|
||||
id: str
|
||||
filename: str
|
||||
caption: Union[Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
caption: Union[None, str]
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
filename = self.filename
|
||||
|
||||
caption: Union[None, str]
|
||||
caption = self.caption
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
@ -32,10 +34,9 @@ class PhotoSearch:
|
||||
{
|
||||
"id": id,
|
||||
"filename": filename,
|
||||
"caption": caption,
|
||||
}
|
||||
)
|
||||
if caption is not UNSET:
|
||||
field_dict["caption"] = caption
|
||||
|
||||
return field_dict
|
||||
|
||||
@ -46,7 +47,12 @@ class PhotoSearch:
|
||||
|
||||
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(
|
||||
id=id,
|
@ -1,6 +1,7 @@
|
||||
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:
|
||||
from ..models.photo_search import PhotoSearch
|
||||
@ -9,7 +10,7 @@ if TYPE_CHECKING:
|
||||
T = TypeVar("T", bound="RandomSearchResultsPhoto")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class RandomSearchResultsPhoto:
|
||||
"""
|
||||
Attributes:
|
||||
@ -17,13 +18,12 @@ class RandomSearchResultsPhoto:
|
||||
"""
|
||||
|
||||
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]:
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -1,6 +1,7 @@
|
||||
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:
|
||||
from ..models.video_search import VideoSearch
|
||||
@ -9,7 +10,7 @@ if TYPE_CHECKING:
|
||||
T = TypeVar("T", bound="RandomSearchResultsVideo")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class RandomSearchResultsVideo:
|
||||
"""
|
||||
Attributes:
|
||||
@ -17,13 +18,12 @@ class RandomSearchResultsVideo:
|
||||
"""
|
||||
|
||||
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]:
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -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 ..types import UNSET, Unset
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.album import Album
|
||||
@ -11,25 +10,25 @@ if TYPE_CHECKING:
|
||||
T = TypeVar("T", bound="SearchResultsAlbum")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class SearchResultsAlbum:
|
||||
"""
|
||||
Attributes:
|
||||
results (List['Album']):
|
||||
next_page (Union[Unset, str]):
|
||||
next_page (Union[None, str]):
|
||||
"""
|
||||
|
||||
results: List["Album"]
|
||||
next_page: Union[Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
next_page: Union[None, str]
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
next_page: Union[None, str]
|
||||
next_page = self.next_page
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
@ -37,10 +36,9 @@ class SearchResultsAlbum:
|
||||
field_dict.update(
|
||||
{
|
||||
"results": results,
|
||||
"next_page": next_page,
|
||||
}
|
||||
)
|
||||
if next_page is not UNSET:
|
||||
field_dict["next_page"] = next_page
|
||||
|
||||
return field_dict
|
||||
|
||||
@ -56,7 +54,12 @@ class SearchResultsAlbum:
|
||||
|
||||
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(
|
||||
results=results,
|
@ -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 ..types import UNSET, Unset
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.photo_search import PhotoSearch
|
||||
@ -11,25 +10,25 @@ if TYPE_CHECKING:
|
||||
T = TypeVar("T", bound="SearchResultsPhoto")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class SearchResultsPhoto:
|
||||
"""
|
||||
Attributes:
|
||||
results (List['PhotoSearch']):
|
||||
next_page (Union[Unset, str]):
|
||||
next_page (Union[None, str]):
|
||||
"""
|
||||
|
||||
results: List["PhotoSearch"]
|
||||
next_page: Union[Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
next_page: Union[None, str]
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
next_page: Union[None, str]
|
||||
next_page = self.next_page
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
@ -37,10 +36,9 @@ class SearchResultsPhoto:
|
||||
field_dict.update(
|
||||
{
|
||||
"results": results,
|
||||
"next_page": next_page,
|
||||
}
|
||||
)
|
||||
if next_page is not UNSET:
|
||||
field_dict["next_page"] = next_page
|
||||
|
||||
return field_dict
|
||||
|
||||
@ -56,7 +54,12 @@ class SearchResultsPhoto:
|
||||
|
||||
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(
|
||||
results=results,
|
@ -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 ..types import UNSET, Unset
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.video_search import VideoSearch
|
||||
@ -11,25 +10,25 @@ if TYPE_CHECKING:
|
||||
T = TypeVar("T", bound="SearchResultsVideo")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class SearchResultsVideo:
|
||||
"""
|
||||
Attributes:
|
||||
results (List['VideoSearch']):
|
||||
next_page (Union[Unset, str]):
|
||||
next_page (Union[None, str]):
|
||||
"""
|
||||
|
||||
results: List["VideoSearch"]
|
||||
next_page: Union[Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
next_page: Union[None, str]
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
next_page: Union[None, str]
|
||||
next_page = self.next_page
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
@ -37,10 +36,9 @@ class SearchResultsVideo:
|
||||
field_dict.update(
|
||||
{
|
||||
"results": results,
|
||||
"next_page": next_page,
|
||||
}
|
||||
)
|
||||
if next_page is not UNSET:
|
||||
field_dict["next_page"] = next_page
|
||||
|
||||
return field_dict
|
||||
|
||||
@ -56,7 +54,12 @@ class SearchResultsVideo:
|
||||
|
||||
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(
|
||||
results=results,
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class Token:
|
||||
"""
|
||||
Attributes:
|
||||
@ -15,10 +16,11 @@ class Token:
|
||||
|
||||
access_token: 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]:
|
||||
access_token = self.access_token
|
||||
|
||||
token_type = self.token_type
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
100
PhotosAPI_Client/photosapi_client/models/user.py
Normal file
100
PhotosAPI_Client/photosapi_client/models/user.py
Normal file
@ -0,0 +1,100 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="User")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class User:
|
||||
"""
|
||||
Attributes:
|
||||
user (str):
|
||||
email (Union[None, str]):
|
||||
quota (Union[None, int]):
|
||||
disabled (Union[None, bool]):
|
||||
"""
|
||||
|
||||
user: str
|
||||
email: Union[None, str]
|
||||
quota: Union[None, int]
|
||||
disabled: Union[None, bool]
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
user = self.user
|
||||
|
||||
email: Union[None, str]
|
||||
email = self.email
|
||||
|
||||
quota: Union[None, int]
|
||||
quota = self.quota
|
||||
|
||||
disabled: Union[None, bool]
|
||||
disabled = self.disabled
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user": user,
|
||||
"email": email,
|
||||
"quota": quota,
|
||||
"disabled": disabled,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
user = d.pop("user")
|
||||
|
||||
def _parse_email(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
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=user,
|
||||
email=email,
|
||||
quota=quota,
|
||||
disabled=disabled,
|
||||
)
|
||||
|
||||
user.additional_properties = d
|
||||
return user
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class ValidationError:
|
||||
"""
|
||||
Attributes:
|
||||
@ -17,18 +18,17 @@ class ValidationError:
|
||||
loc: List[Union[int, str]]
|
||||
msg: 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]:
|
||||
loc = []
|
||||
for loc_item_data in self.loc:
|
||||
loc_item: Union[int, str]
|
||||
|
||||
loc_item = loc_item_data
|
||||
|
||||
loc.append(loc_item)
|
||||
|
||||
msg = self.msg
|
||||
|
||||
type = self.type
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class Video:
|
||||
"""
|
||||
Attributes:
|
||||
@ -19,12 +20,15 @@ class Video:
|
||||
album: str
|
||||
hash_: 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]:
|
||||
id = self.id
|
||||
|
||||
album = self.album
|
||||
|
||||
hash_ = self.hash_
|
||||
|
||||
filename = self.filename
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -1,11 +1,12 @@
|
||||
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")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class VideoPublic:
|
||||
"""
|
||||
Attributes:
|
||||
@ -17,11 +18,13 @@ class VideoPublic:
|
||||
id: str
|
||||
caption: 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]:
|
||||
id = self.id
|
||||
|
||||
caption = self.caption
|
||||
|
||||
filename = self.filename
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
@ -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 ..types import UNSET, Unset
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="VideoSearch")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@_attrs_define
|
||||
class VideoSearch:
|
||||
"""
|
||||
Attributes:
|
||||
id (str):
|
||||
filename (str):
|
||||
caption (Union[Unset, str]):
|
||||
caption (Union[None, str]):
|
||||
"""
|
||||
|
||||
id: str
|
||||
filename: str
|
||||
caption: Union[Unset, str] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
caption: Union[None, str]
|
||||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
filename = self.filename
|
||||
|
||||
caption: Union[None, str]
|
||||
caption = self.caption
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
@ -32,10 +34,9 @@ class VideoSearch:
|
||||
{
|
||||
"id": id,
|
||||
"filename": filename,
|
||||
"caption": caption,
|
||||
}
|
||||
)
|
||||
if caption is not UNSET:
|
||||
field_dict["caption"] = caption
|
||||
|
||||
return field_dict
|
||||
|
||||
@ -46,7 +47,12 @@ class VideoSearch:
|
||||
|
||||
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(
|
||||
id=id,
|
@ -1,8 +1,9 @@
|
||||
""" Contains some shared types for properties """
|
||||
|
||||
from http import HTTPStatus
|
||||
from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar
|
||||
|
||||
import attr
|
||||
from attrs import define
|
||||
|
||||
|
||||
class Unset:
|
||||
@ -15,7 +16,7 @@ UNSET: Unset = Unset()
|
||||
FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]]
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@define
|
||||
class File:
|
||||
"""Contains information for file uploads"""
|
||||
|
||||
@ -31,7 +32,7 @@ class File:
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@define
|
||||
class Response(Generic[T]):
|
||||
"""A response from an endpoint"""
|
||||
|
||||
@ -41,4 +42,4 @@ class Response(Generic[T]):
|
||||
parsed: Optional[T]
|
||||
|
||||
|
||||
__all__ = ["File", "Response", "FileJsonType"]
|
||||
__all__ = ["File", "Response", "FileJsonType", "Unset", "UNSET"]
|
@ -7,7 +7,7 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
|
||||
|
||||
setup(
|
||||
name="PhotosAPI_Client",
|
||||
version="0.5.0",
|
||||
version="0.6.0",
|
||||
description="A client library for accessing Photos API",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
110
README.md
110
README.md
@ -1,95 +1,43 @@
|
||||
# PhotosAPI_Client
|
||||
|
||||
A client library for accessing Photos API
|
||||
Generated using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client) client library for [PhotosAPI](https://git.end-play.xyz/profitroll/PhotosAPI)
|
||||
|
||||
## Usage
|
||||
|
||||
First, create a client:
|
||||
Please, refer to [library README](PhotosAPI_Client/README.md)
|
||||
|
||||
```python
|
||||
from photosapi_client import Client
|
||||
## Building / generating this Client
|
||||
|
||||
client = Client(base_url="https://api.example.com")
|
||||
```
|
||||
This project is separated into to parts:
|
||||
|
||||
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
||||
1. The generator (located where this README is)
|
||||
2. The generated library (located under `PhotosAPI_Client/`)
|
||||
|
||||
```python
|
||||
from photosapi_client import AuthenticatedClient
|
||||
### Generating
|
||||
|
||||
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
||||
```
|
||||
1. Create a virtual environment `.venv` in the repository root:
|
||||
`python -m venv .venv` / `virtualenv .venv`
|
||||
2. Use this virtual environment:
|
||||
`source .venv/bin/activate` / `.venv\Scripts\activate.ps1`
|
||||
3. Install the dependencies:
|
||||
`pip install -r requirements.txt`
|
||||
4. Generate/update the client:
|
||||
* Generate: `openapi-python-client generate --config config.yaml --url "OPENAPI_SPEC_URL"` (replace `OPENAPI_SPEC_URL` with your URL)
|
||||
* Update: `openapi-python-client update --config config.yaml --url "OPENAPI_SPEC_URL"` (replace `OPENAPI_SPEC_URL` with your URL)
|
||||
|
||||
Now call your endpoint and use your models:
|
||||
### Building
|
||||
|
||||
```python
|
||||
from photosapi_client.models import MyDataModel
|
||||
from photosapi_client.api.my_tag import get_my_data_model
|
||||
from photosapi_client.types import Response
|
||||
1. Create a virtual environment `.venv` in the repository root:
|
||||
`python -m venv .venv` / `virtualenv .venv`
|
||||
2. Use this virtual environment:
|
||||
`source .venv/bin/activate` / `.venv\Scripts\activate.ps1`
|
||||
3. Install the dependencies:
|
||||
`pip install -r requirements.txt`
|
||||
4. Build the client:
|
||||
`python -m build ./PhotosAPI_Client`
|
||||
5. Artifacts can be found under `PhotosAPI_Client/dist`
|
||||
|
||||
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
||||
# or if you need more info (e.g. status_code)
|
||||
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
||||
```
|
||||
### Generating and building with VSCode
|
||||
|
||||
Or do the same thing with an async version:
|
||||
|
||||
```python
|
||||
from photosapi_client.models import MyDataModel
|
||||
from photosapi_client.api.my_tag import get_my_data_model
|
||||
from photosapi_client.types import Response
|
||||
|
||||
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
||||
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
||||
```
|
||||
|
||||
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
||||
|
||||
```python
|
||||
client = AuthenticatedClient(
|
||||
base_url="https://internal_api.example.com",
|
||||
token="SuperSecretToken",
|
||||
verify_ssl="/path/to/certificate_bundle.pem",
|
||||
)
|
||||
```
|
||||
|
||||
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
||||
|
||||
```python
|
||||
client = AuthenticatedClient(
|
||||
base_url="https://internal_api.example.com",
|
||||
token="SuperSecretToken",
|
||||
verify_ssl=False
|
||||
)
|
||||
```
|
||||
|
||||
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info.
|
||||
|
||||
Things to know:
|
||||
|
||||
1. Every path/method combo becomes a Python module with four functions:
|
||||
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
||||
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
||||
1. `asyncio`: Like `sync` but async instead of blocking
|
||||
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
||||
|
||||
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. 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>`
|
||||
1. Steps about virtual environments **MUST** be completed first
|
||||
2. Use `Terminal > Run Task` to select the task you want to start
|
||||
|
@ -1,66 +0,0 @@
|
||||
import ssl
|
||||
from typing import Dict, Union
|
||||
|
||||
import attr
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class Client:
|
||||
"""A class for keeping track of data related to the API
|
||||
|
||||
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
|
||||
status code that was not documented in the source OpenAPI document.
|
||||
follow_redirects: Whether or not to follow redirects. Default value is False.
|
||||
"""
|
||||
|
||||
base_url: str
|
||||
cookies: Dict[str, str] = attr.ib(factory=dict, kw_only=True)
|
||||
headers: Dict[str, str] = attr.ib(factory=dict, kw_only=True)
|
||||
timeout: float = attr.ib(5.0, kw_only=True)
|
||||
verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, kw_only=True)
|
||||
raise_on_unexpected_status: bool = attr.ib(False, kw_only=True)
|
||||
follow_redirects: bool = attr.ib(False, kw_only=True)
|
||||
|
||||
def get_headers(self) -> Dict[str, str]:
|
||||
"""Get headers to be used in all endpoints"""
|
||||
return {**self.headers}
|
||||
|
||||
def with_headers(self, headers: Dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
return attr.evolve(self, headers={**self.headers, **headers})
|
||||
|
||||
def get_cookies(self) -> Dict[str, str]:
|
||||
return {**self.cookies}
|
||||
|
||||
def with_cookies(self, cookies: Dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional cookies"""
|
||||
return attr.evolve(self, cookies={**self.cookies, **cookies})
|
||||
|
||||
def get_timeout(self) -> float:
|
||||
return self.timeout
|
||||
|
||||
def with_timeout(self, timeout: float) -> "Client":
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
return attr.evolve(self, timeout=timeout)
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class AuthenticatedClient(Client):
|
||||
"""A Client which has been authenticated for use on secured endpoints"""
|
||||
|
||||
token: str
|
||||
prefix: str = "Bearer"
|
||||
auth_header_name: str = "Authorization"
|
||||
|
||||
def get_headers(self) -> Dict[str, str]:
|
||||
"""Get headers to be used in authenticated endpoints"""
|
||||
auth_header_value = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
return {self.auth_header_name: auth_header_value, **self.headers}
|
@ -1,75 +0,0 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||
|
||||
import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="User")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class User:
|
||||
"""
|
||||
Attributes:
|
||||
user (str):
|
||||
email (Union[Unset, str]):
|
||||
disabled (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
user: str
|
||||
email: Union[Unset, str] = UNSET
|
||||
disabled: Union[Unset, bool] = UNSET
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
user = self.user
|
||||
email = self.email
|
||||
disabled = self.disabled
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user": user,
|
||||
}
|
||||
)
|
||||
if email is not UNSET:
|
||||
field_dict["email"] = email
|
||||
if disabled is not UNSET:
|
||||
field_dict["disabled"] = disabled
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
user = d.pop("user")
|
||||
|
||||
email = d.pop("email", UNSET)
|
||||
|
||||
disabled = d.pop("disabled", UNSET)
|
||||
|
||||
user = cls(
|
||||
user=user,
|
||||
email=email,
|
||||
disabled=disabled,
|
||||
)
|
||||
|
||||
user.additional_properties = d
|
||||
return user
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> List[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
5
requirements.txt
Normal file
5
requirements.txt
Normal 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
|
Loading…
Reference in New Issue
Block a user