Initial commit
This commit is contained in:
commit
822afbee87
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
__pycache__/
|
||||
build/
|
||||
dist/
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# JetBrains
|
||||
.idea/
|
||||
|
||||
/coverage.xml
|
||||
/.coverage
|
7
PhotosAPI_Client/__init__.py
Normal file
7
PhotosAPI_Client/__init__.py
Normal file
@ -0,0 +1,7 @@
|
||||
""" A client library for accessing END PLAY Photos """
|
||||
from .client import AuthenticatedClient, Client
|
||||
|
||||
__all__ = (
|
||||
"AuthenticatedClient",
|
||||
"Client",
|
||||
)
|
1
PhotosAPI_Client/api/__init__.py
Normal file
1
PhotosAPI_Client/api/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
""" Contains methods for accessing the API """
|
0
PhotosAPI_Client/api/default/__init__.py
Normal file
0
PhotosAPI_Client/api/default/__init__.py
Normal file
198
PhotosAPI_Client/api/default/album_create_albums_post.py
Normal file
198
PhotosAPI_Client/api/default/album_create_albums_post.py
Normal file
@ -0,0 +1,198 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.album import Album
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/albums".format(client.base_url)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["name"] = name
|
||||
|
||||
params["title"] = title
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
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())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_ACCEPTABLE:
|
||||
response_406 = cast(Any, None)
|
||||
return response_406
|
||||
if response.status_code == HTTPStatus.CONFLICT:
|
||||
response_409 = cast(Any, None)
|
||||
return response_409
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Album, Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
) -> Response[Union[Album, Any, HTTPValidationError]]:
|
||||
"""Album Create
|
||||
|
||||
Create album with name and title
|
||||
|
||||
Args:
|
||||
name (str):
|
||||
title (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Album, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
) -> Optional[Union[Album, Any, HTTPValidationError]]:
|
||||
"""Album Create
|
||||
|
||||
Create album with name and title
|
||||
|
||||
Args:
|
||||
name (str):
|
||||
title (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Album, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
) -> Response[Union[Album, Any, HTTPValidationError]]:
|
||||
"""Album Create
|
||||
|
||||
Create album with name and title
|
||||
|
||||
Args:
|
||||
name (str):
|
||||
title (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Album, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
)
|
||||
|
||||
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: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
) -> Optional[Union[Album, Any, HTTPValidationError]]:
|
||||
"""Album Create
|
||||
|
||||
Create album with name and title
|
||||
|
||||
Args:
|
||||
name (str):
|
||||
title (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Album, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
)
|
||||
).parsed
|
172
PhotosAPI_Client/api/default/album_delete_album_id_delete.py
Normal file
172
PhotosAPI_Client/api/default/album_delete_album_id_delete.py
Normal file
@ -0,0 +1,172 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/album/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Album Delete
|
||||
|
||||
Delete album by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Album Delete
|
||||
|
||||
Delete album by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Album Delete
|
||||
|
||||
Delete album by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
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(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Album Delete
|
||||
|
||||
Delete album by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
181
PhotosAPI_Client/api/default/album_find_albums_get.py
Normal file
181
PhotosAPI_Client/api/default/album_find_albums_get.py
Normal file
@ -0,0 +1,181 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.search_results_album import SearchResultsAlbum
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/albums".format(client.base_url)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["q"] = q
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = SearchResultsAlbum.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: str,
|
||||
) -> Response[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
"""Album Find
|
||||
|
||||
Find album by name
|
||||
|
||||
Args:
|
||||
q (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, SearchResultsAlbum]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
q=q,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: str,
|
||||
) -> Optional[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
"""Album Find
|
||||
|
||||
Find album by name
|
||||
|
||||
Args:
|
||||
q (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, SearchResultsAlbum]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
q=q,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: str,
|
||||
) -> Response[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
"""Album Find
|
||||
|
||||
Find album by name
|
||||
|
||||
Args:
|
||||
q (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, SearchResultsAlbum]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
q=q,
|
||||
)
|
||||
|
||||
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: AuthenticatedClient,
|
||||
q: str,
|
||||
) -> Optional[Union[HTTPValidationError, SearchResultsAlbum]]:
|
||||
"""Album Find
|
||||
|
||||
Find album by name
|
||||
|
||||
Args:
|
||||
q (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, SearchResultsAlbum]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
q=q,
|
||||
)
|
||||
).parsed
|
230
PhotosAPI_Client/api/default/album_patch_albums_id_patch.py
Normal file
230
PhotosAPI_Client/api/default/album_patch_albums_id_patch.py
Normal file
@ -0,0 +1,230 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.album_modified import AlbumModified
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
) -> 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
|
||||
|
||||
params["cover"] = cover
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "patch",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = AlbumModified.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if response.status_code == HTTPStatus.NOT_ACCEPTABLE:
|
||||
response_406 = cast(Any, None)
|
||||
return response_406
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Patch
|
||||
|
||||
Modify album's name or title by id
|
||||
|
||||
Args:
|
||||
id (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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
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
|
||||
|
||||
Modify album's name or title by id
|
||||
|
||||
Args:
|
||||
id (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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Patch
|
||||
|
||||
Modify album's name or title by id
|
||||
|
||||
Args:
|
||||
id (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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: Union[Unset, None, str] = UNSET,
|
||||
title: Union[Unset, None, str] = UNSET,
|
||||
cover: Union[Unset, None, str] = UNSET,
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Patch
|
||||
|
||||
Modify album's name or title by id
|
||||
|
||||
Args:
|
||||
id (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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
).parsed
|
230
PhotosAPI_Client/api/default/album_put_albums_id_put.py
Normal file
230
PhotosAPI_Client/api/default/album_put_albums_id_put.py
Normal file
@ -0,0 +1,230 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.album_modified import AlbumModified
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
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
|
||||
|
||||
params["cover"] = cover
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = AlbumModified.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if response.status_code == HTTPStatus.NOT_ACCEPTABLE:
|
||||
response_406 = cast(Any, None)
|
||||
return response_406
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
cover: str,
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Put
|
||||
|
||||
Modify album's name and title by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (str):
|
||||
title (str):
|
||||
cover (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
cover: str,
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Put
|
||||
|
||||
Modify album's name and title by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (str):
|
||||
title (str):
|
||||
cover (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
cover: str,
|
||||
) -> Response[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Put
|
||||
|
||||
Modify album's name and title by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (str):
|
||||
title (str):
|
||||
cover (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
name: str,
|
||||
title: str,
|
||||
cover: str,
|
||||
) -> Optional[Union[AlbumModified, Any, HTTPValidationError]]:
|
||||
"""Album Put
|
||||
|
||||
Modify album's name and title by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
name (str):
|
||||
title (str):
|
||||
cover (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
name=name,
|
||||
title=title,
|
||||
cover=cover,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,156 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
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
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/token".format(client.base_url)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"data": form_data.to_dict(),
|
||||
}
|
||||
|
||||
|
||||
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())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
response_401 = cast(Any, None)
|
||||
return response_401
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, Token]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Response[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Response[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
)
|
||||
|
||||
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: Client,
|
||||
form_data: BodyLoginForAccessTokenTokenPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Token]]:
|
||||
"""Login For Access Token
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
)
|
||||
).parsed
|
172
PhotosAPI_Client/api/default/photo_delete_photos_id_delete.py
Normal file
172
PhotosAPI_Client/api/default/photo_delete_photos_id_delete.py
Normal file
@ -0,0 +1,172 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/photos/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Delete
|
||||
|
||||
Delete a photo by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Delete
|
||||
|
||||
Delete a photo by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Delete
|
||||
|
||||
Delete a photo by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
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(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Delete
|
||||
|
||||
Delete a photo by id
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
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.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,284 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.search_results_photo import SearchResultsPhoto
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
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
|
||||
|
||||
params["caption"] = caption
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["page_size"] = page_size
|
||||
|
||||
params["lat"] = lat
|
||||
|
||||
params["lng"] = lng
|
||||
|
||||
params["radius"] = radius
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
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())
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
||||
response_422 = cast(Any, None)
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SearchResultsPhoto]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: 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
|
||||
|
||||
Find a photo by filename
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (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]):
|
||||
|
||||