Compare commits

..

No commits in common. "dev" and "master" have entirely different histories.
dev ... master

66 changed files with 1190 additions and 1592 deletions

3
.gitignore vendored
View File

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

53
.vscode/tasks.json vendored
View File

@ -1,53 +0,0 @@
{
// 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": []
}
]
}

View File

@ -1,23 +0,0 @@
__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

View File

@ -1,78 +0,0 @@
# 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`

View File

@ -1,268 +0,0 @@
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)

View File

@ -1,100 +0,0 @@
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

110
README.md
View File

@ -1,43 +1,95 @@
# PhotosAPI_Client
Generated using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client) client library for [PhotosAPI](https://git.end-play.xyz/profitroll/PhotosAPI)
A client library for accessing Photos API
## Usage
Please, refer to [library README](PhotosAPI_Client/README.md)
First, create a client:
## Building / generating this Client
```python
from photosapi_client import Client
This project is separated into to parts:
client = Client(base_url="https://api.example.com")
```
1. The generator (located where this README is)
2. The generated library (located under `PhotosAPI_Client/`)
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
### Generating
```python
from photosapi_client import AuthenticatedClient
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)
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
```
### Building
Now call your endpoint and use your models:
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`
```python
from photosapi_client.models import MyDataModel
from photosapi_client.api.my_tag import get_my_data_model
from photosapi_client.types import Response
### Generating and building with VSCode
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)
```
1. Steps about virtual environments **MUST** be completed first
2. Use `Terminal > Run Task` to select the task you want to start
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>`

View File

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

View File

@ -12,30 +12,34 @@ 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}
_kwargs: Dict[str, Any] = {
return {
"method": "post",
"url": "/albums",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Album, Any, HTTPValidationError]]:
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Album, Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK:
response_200 = Album.from_dict(response.json())
@ -56,9 +60,7 @@ def _parse_response(
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Album, Any, HTTPValidationError]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Album, Any, HTTPValidationError]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
@ -90,11 +92,13 @@ def sync_detailed(
"""
kwargs = _get_kwargs(
client=client,
name=name,
title=title,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -153,11 +157,13 @@ async def asyncio_detailed(
"""
kwargs = _get_kwargs(
client=client,
name=name,
title=title,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)

View File

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

View File

@ -12,26 +12,32 @@ 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}
_kwargs: Dict[str, Any] = {
return {
"method": "get",
"url": "/albums",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Optional[Union[HTTPValidationError, SearchResultsAlbum]]:
if response.status_code == HTTPStatus.OK:
response_200 = SearchResultsAlbum.from_dict(response.json())
@ -48,7 +54,7 @@ def _parse_response(
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Response[Union[HTTPValidationError, SearchResultsAlbum]]:
return Response(
status_code=HTTPStatus(response.status_code),
@ -79,10 +85,12 @@ def sync_detailed(
"""
kwargs = _get_kwargs(
client=client,
q=q,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -136,10 +144,12 @@ async def asyncio_detailed(
"""
kwargs = _get_kwargs(
client=client,
q=q,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)

View File

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

View File

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

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...client import 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,27 +13,26 @@ from ...types import Response
def _get_kwargs(
*,
body: BodyLoginForAccessTokenTokenPost,
client: Client,
form_data: BodyLoginForAccessTokenTokenPost,
) -> Dict[str, Any]:
headers: Dict[str, Any] = {}
url = "{}/token".format(client.base_url)
_kwargs: Dict[str, Any] = {
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "post",
"url": "/token",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(),
}
_body = body.to_dict()
_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]]:
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError, Token]]:
if response.status_code == HTTPStatus.OK:
response_200 = Token.from_dict(response.json())
@ -51,9 +50,7 @@ def _parse_response(
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, Token]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, Token]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
@ -64,14 +61,11 @@ def _build_response(
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
body: BodyLoginForAccessTokenTokenPost,
client: Client,
form_data: 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.
@ -81,10 +75,12 @@ def sync_detailed(
"""
kwargs = _get_kwargs(
body=body,
client=client,
form_data=form_data,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -93,14 +89,11 @@ def sync_detailed(
def sync(
*,
client: Union[AuthenticatedClient, Client],
body: BodyLoginForAccessTokenTokenPost,
client: Client,
form_data: 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.
@ -111,20 +104,17 @@ def sync(
return sync_detailed(
client=client,
body=body,
form_data=form_data,
).parsed
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
body: BodyLoginForAccessTokenTokenPost,
client: Client,
form_data: 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.
@ -134,24 +124,23 @@ async def asyncio_detailed(
"""
kwargs = _get_kwargs(
body=body,
client=client,
form_data=form_data,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
*,
client: Union[AuthenticatedClient, Client],
body: BodyLoginForAccessTokenTokenPost,
client: Client,
form_data: 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.
@ -163,6 +152,6 @@ async def asyncio(
return (
await asyncio_detailed(
client=client,
body=body,
form_data=form_data,
)
).parsed

View File

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

View File

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

View File

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

View File

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

View File

@ -13,28 +13,32 @@ 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}
_kwargs: Dict[str, Any] = {
return {
"method": "put",
"url": "/photos/{id}".format(
id=id,
),
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
if response.status_code == HTTPStatus.OK:
response_200 = PhotoPublic.from_dict(response.json())
@ -54,7 +58,7 @@ def _parse_response(
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
return Response(
status_code=HTTPStatus(response.status_code),
@ -88,10 +92,12 @@ def sync_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
album=album,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -151,10 +157,12 @@ async def asyncio_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
album=album,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)

View File

@ -13,28 +13,32 @@ 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}
_kwargs: Dict[str, Any] = {
return {
"method": "patch",
"url": "/photos/{id}".format(
id=id,
),
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
if response.status_code == HTTPStatus.OK:
response_200 = PhotoPublic.from_dict(response.json())
@ -54,7 +58,7 @@ def _parse_response(
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
return Response(
status_code=HTTPStatus(response.status_code),
@ -88,10 +92,12 @@ def sync_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
caption=caption,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -151,10 +157,12 @@ async def asyncio_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
caption=caption,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,27 +12,26 @@ from ...types import Response
def _get_kwargs(
*,
body: BodyUserDeleteUsersMeDelete,
client: AuthenticatedClient,
form_data: BodyUserDeleteUsersMeDelete,
) -> Dict[str, Any]:
headers: Dict[str, Any] = {}
url = "{}/users/me/".format(client.base_url)
_kwargs: Dict[str, Any] = {
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"method": "delete",
"url": "/users/me/",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(),
}
_body = body.to_dict()
_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]]:
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
if response.status_code == HTTPStatus.NO_CONTENT:
response_204 = cast(Any, None)
return response_204
@ -49,9 +48,7 @@ def _parse_response(
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, HTTPValidationError]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
@ -63,13 +60,10 @@ def _build_response(
def sync_detailed(
*,
client: AuthenticatedClient,
body: BodyUserDeleteUsersMeDelete,
form_data: 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.
@ -79,10 +73,12 @@ def sync_detailed(
"""
kwargs = _get_kwargs(
body=body,
client=client,
form_data=form_data,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -92,13 +88,10 @@ def sync_detailed(
def sync(
*,
client: AuthenticatedClient,
body: BodyUserDeleteUsersMeDelete,
form_data: 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.
@ -109,20 +102,17 @@ def sync(
return sync_detailed(
client=client,
body=body,
form_data=form_data,
).parsed
async def asyncio_detailed(
*,
client: AuthenticatedClient,
body: BodyUserDeleteUsersMeDelete,
form_data: 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.
@ -132,10 +122,12 @@ async def asyncio_detailed(
"""
kwargs = _get_kwargs(
body=body,
client=client,
form_data=form_data,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)
@ -143,13 +135,10 @@ async def asyncio_detailed(
async def asyncio(
*,
client: AuthenticatedClient,
body: BodyUserDeleteUsersMeDelete,
form_data: 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.
@ -161,6 +150,6 @@ async def asyncio(
return (
await asyncio_detailed(
client=client,
body=body,
form_data=form_data,
)
).parsed

View File

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

View File

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

View File

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

View File

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

View File

@ -13,28 +13,32 @@ 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}
_kwargs: Dict[str, Any] = {
return {
"method": "put",
"url": "/videos/{id}".format(
id=id,
),
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
if response.status_code == HTTPStatus.OK:
response_200 = VideoPublic.from_dict(response.json())
@ -54,7 +58,7 @@ def _parse_response(
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
return Response(
status_code=HTTPStatus(response.status_code),
@ -88,10 +92,12 @@ def sync_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
album=album,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -151,10 +157,12 @@ async def asyncio_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
album=album,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)

View File

@ -13,28 +13,32 @@ 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}
_kwargs: Dict[str, Any] = {
return {
"method": "patch",
"url": "/videos/{id}".format(
id=id,
),
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
if response.status_code == HTTPStatus.OK:
response_200 = VideoPublic.from_dict(response.json())
@ -54,7 +58,7 @@ def _parse_response(
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
*, client: Client, response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
return Response(
status_code=HTTPStatus(response.status_code),
@ -88,10 +92,12 @@ def sync_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
caption=caption,
)
response = client.get_httpx_client().request(
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
@ -151,10 +157,12 @@ async def asyncio_detailed(
kwargs = _get_kwargs(
id=id,
client=client,
caption=caption,
)
response = await client.get_async_httpx_client().request(**kwargs)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)

View File

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

View File

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

View File

@ -0,0 +1,66 @@
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}

View File

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

View File

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

View File

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

View File

@ -1,56 +1,38 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
from typing import Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="BodyLoginForAccessTokenTokenPost")
@_attrs_define
@attr.s(auto_attribs=True)
class BodyLoginForAccessTokenTokenPost:
"""
Attributes:
username (str):
password (str):
grant_type (Union[None, Unset, str]):
grant_type (Union[Unset, str]):
scope (Union[Unset, str]): Default: ''.
client_id (Union[None, Unset, str]):
client_secret (Union[None, Unset, str]):
client_id (Union[Unset, str]):
client_secret (Union[Unset, str]):
"""
username: str
password: str
grant_type: Union[None, Unset, str] = UNSET
grant_type: Union[Unset, str] = UNSET
scope: Union[Unset, str] = ""
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)
client_id: Union[Unset, str] = UNSET
client_secret: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
username = self.username
password = self.password
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: 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] = {}
@ -79,34 +61,13 @@ class BodyLoginForAccessTokenTokenPost:
password = d.pop("password")
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))
grant_type = d.pop("grant_type", UNSET)
scope = d.pop("scope", 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_id = d.pop("client_id", 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))
client_secret = d.pop("client_secret", UNSET)
body_login_for_access_token_token_post = cls(
username=username,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,75 @@
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

View File

@ -1,12 +1,11 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
from attrs import define as _attrs_define
from attrs import field as _attrs_field
import attr
T = TypeVar("T", bound="ValidationError")
@_attrs_define
@attr.s(auto_attribs=True)
class ValidationError:
"""
Attributes:
@ -18,17 +17,18 @@ class ValidationError:
loc: List[Union[int, str]]
msg: str
type: str
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
additional_properties: Dict[str, Any] = attr.ib(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] = {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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