Changed API project name
This commit is contained in:
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]):
|
||||
|
||||
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, SearchResultsPhoto]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
||||
lng=lng,
|
||||
radius=radius,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
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,
|
||||
) -> Optional[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]):
|
||||
|
||||
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, SearchResultsPhoto]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
||||
lng=lng,
|
||||
radius=radius,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_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]):
|
||||
|
||||
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, SearchResultsPhoto]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
||||
lng=lng,
|
||||
radius=radius,
|
||||
)
|
||||
|
||||
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(
|
||||
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,
|
||||
) -> Optional[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]):
|
||||
|
||||
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, SearchResultsPhoto]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
||||
lng=lng,
|
||||
radius=radius,
|
||||
)
|
||||
).parsed
|
172
photosapi_client/api/default/photo_get_photos_id_get.py
Normal file
172
photosapi_client/api/default/photo_get_photos_id_get.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": "get",
|
||||
"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.OK:
|
||||
response_200 = cast(Any, 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.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 Get
|
||||
|
||||
Get 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 Get
|
||||
|
||||
Get 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 Get
|
||||
|
||||
Get 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 Get
|
||||
|
||||
Get 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,194 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
id: int,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/token/photo/{token}".format(client.base_url, token=token)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["id"] = id
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"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, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = cast(Any, response.json())
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
response_401 = cast(Any, None)
|
||||
return response_401
|
||||
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(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
id: int,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
||||
|
||||
Get a photo by its duplicate token
|
||||
|
||||
Args:
|
||||
token (str):
|
||||
id (int):
|
||||
|
||||
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(
|
||||
token=token,
|
||||
client=client,
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
id: int,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
||||
|
||||
Get a photo by its duplicate token
|
||||
|
||||
Args:
|
||||
token (str):
|
||||
id (int):
|
||||
|
||||
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(
|
||||
token=token,
|
||||
client=client,
|
||||
id=id,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
id: int,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
||||
|
||||
Get a photo by its duplicate token
|
||||
|
||||
Args:
|
||||
token (str):
|
||||
id (int):
|
||||
|
||||
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(
|
||||
token=token,
|
||||
client=client,
|
||||
id=id,
|
||||
)
|
||||
|
||||
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(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
id: int,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Photo Get Token
|
||||
|
||||
Get a photo by its duplicate token
|
||||
|
||||
Args:
|
||||
token (str):
|
||||
id (int):
|
||||
|
||||
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(
|
||||
token=token,
|
||||
client=client,
|
||||
id=id,
|
||||
)
|
||||
).parsed
|
197
photosapi_client/api/default/photo_move_photos_id_put.py
Normal file
197
photosapi_client/api/default/photo_move_photos_id_put.py
Normal file
@@ -0,0 +1,197 @@
|
||||
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 ...models.photo_public import PhotoPublic
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/photos/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["album"] = album
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PhotoPublic.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.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, PhotoPublic]]:
|
||||
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,
|
||||
album: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Move
|
||||
|
||||
Move a photo to another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Move
|
||||
|
||||
Move a photo to another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Move
|
||||
|
||||
Move a photo to another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
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,
|
||||
album: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Move
|
||||
|
||||
Move a photo to another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
).parsed
|
197
photosapi_client/api/default/photo_patch_photos_id_patch.py
Normal file
197
photosapi_client/api/default/photo_patch_photos_id_patch.py
Normal file
@@ -0,0 +1,197 @@
|
||||
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 ...models.photo_public import PhotoPublic
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/photos/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["caption"] = caption
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "patch",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PhotoPublic.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.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, PhotoPublic]]:
|
||||
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,
|
||||
caption: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Patch
|
||||
|
||||
Change properties of a photo
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Patch
|
||||
|
||||
Change properties of a photo
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Patch
|
||||
|
||||
Change properties of a photo
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
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,
|
||||
caption: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, PhotoPublic]]:
|
||||
"""Photo Patch
|
||||
|
||||
Change properties of a photo
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, PhotoPublic]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
).parsed
|
@@ -0,0 +1,243 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.body_photo_upload_albums_album_photos_post import BodyPhotoUploadAlbumsAlbumPhotosPost
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.photo import Photo
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> 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
|
||||
|
||||
params["caption"] = caption
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
multipart_multipart_data = multipart_data.to_multipart()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"files": multipart_multipart_data,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
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.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
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[Any, HTTPValidationError, Photo]]:
|
||||
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,
|
||||
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
|
||||
|
||||
Upload a photo to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Photo]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Photo]]:
|
||||
"""Photo Upload
|
||||
|
||||
Upload a photo to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Photo]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Response[Union[Any, HTTPValidationError, Photo]]:
|
||||
"""Photo Upload
|
||||
|
||||
Upload a photo to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Photo]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
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(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyPhotoUploadAlbumsAlbumPhotosPost,
|
||||
ignore_duplicates: Union[Unset, None, bool] = False,
|
||||
compress: Union[Unset, None, bool] = True,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Photo]]:
|
||||
"""Photo Upload
|
||||
|
||||
Upload a photo to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Photo]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
ignore_duplicates=ignore_duplicates,
|
||||
compress=compress,
|
||||
caption=caption,
|
||||
)
|
||||
).parsed
|
@@ -0,0 +1,183 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/{user}/confirm".format(client.base_url, user=user)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["code"] = code
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"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, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = cast(Any, 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.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(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
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(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
).parsed
|
@@ -0,0 +1,183 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/{user}/confirm".format(client.base_url, user=user)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["code"] = code
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "patch",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = cast(Any, 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.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(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
|
||||
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(
|
||||
user: str,
|
||||
*,
|
||||
client: Client,
|
||||
code: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Confirm
|
||||
|
||||
Args:
|
||||
user (str):
|
||||
code (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(
|
||||
user=user,
|
||||
client=client,
|
||||
code=code,
|
||||
)
|
||||
).parsed
|
154
photosapi_client/api/default/user_create_users_post.py
Normal file
154
photosapi_client/api/default/user_create_users_post.py
Normal file
@@ -0,0 +1,154 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import Client
|
||||
from ...models.body_user_create_users_post import BodyUserCreateUsersPost
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users".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]]:
|
||||
if response.status_code == HTTPStatus.NO_CONTENT:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
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[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: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
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(
|
||||
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: BodyUserCreateUsersPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
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(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
form_data: BodyUserCreateUsersPost,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
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(
|
||||
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: BodyUserCreateUsersPost,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Create
|
||||
|
||||
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(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
)
|
||||
).parsed
|
154
photosapi_client/api/default/user_delete_users_me_delete.py
Normal file
154
photosapi_client/api/default/user_delete_users_me_delete.py
Normal file
@@ -0,0 +1,154 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.body_user_delete_users_me_delete import BodyUserDeleteUsersMeDelete
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/me/".format(client.base_url)
|
||||
|
||||
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(),
|
||||
"data": form_data.to_dict(),
|
||||
}
|
||||
|
||||
|
||||
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.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]]:
|
||||
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,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
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(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
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(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
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(
|
||||
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: AuthenticatedClient,
|
||||
form_data: BodyUserDeleteUsersMeDelete,
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""User Delete
|
||||
|
||||
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(
|
||||
client=client,
|
||||
form_data=form_data,
|
||||
)
|
||||
).parsed
|
137
photosapi_client/api/default/user_me_users_me_get.py
Normal file
137
photosapi_client/api/default/user_me_users_me_get.py
Normal file
@@ -0,0 +1,137 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.user import User
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/me/".format(client.base_url)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[User]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = User.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
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[User]:
|
||||
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,
|
||||
) -> Response[User]:
|
||||
"""User Me
|
||||
|
||||
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[User]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[User]:
|
||||
"""User Me
|
||||
|
||||
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[User]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[User]:
|
||||
"""User Me
|
||||
|
||||
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[User]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
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(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[User]:
|
||||
"""User Me
|
||||
|
||||
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[User]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
172
photosapi_client/api/default/video_delete_videos_id_delete.py
Normal file
172
photosapi_client/api/default/video_delete_videos_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 = "{}/videos/{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]]:
|
||||
"""Video Delete
|
||||
|
||||
Delete a video 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]]:
|
||||
"""Video Delete
|
||||
|
||||
Delete a video 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]]:
|
||||
"""Video Delete
|
||||
|
||||
Delete a video 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]]:
|
||||
"""Video Delete
|
||||
|
||||
Delete a video 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,239 @@
|
||||
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_video import SearchResultsVideo
|
||||
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,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/albums/{album}/videos".format(client.base_url, album=album)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["q"] = q
|
||||
|
||||
params["caption"] = caption
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["page_size"] = page_size
|
||||
|
||||
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, SearchResultsVideo]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = SearchResultsVideo.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, SearchResultsVideo]]:
|
||||
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,
|
||||
) -> Response[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video 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.
|
||||
|
||||
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, SearchResultsVideo]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
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,
|
||||
) -> Optional[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video 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.
|
||||
|
||||
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, SearchResultsVideo]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_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,
|
||||
) -> Response[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video 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.
|
||||
|
||||
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, SearchResultsVideo]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
)
|
||||
|
||||
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(
|
||||
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,
|
||||
) -> Optional[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video 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.
|
||||
|
||||
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, SearchResultsVideo]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
)
|
||||
).parsed
|
172
photosapi_client/api/default/video_get_videos_id_get.py
Normal file
172
photosapi_client/api/default/video_get_videos_id_get.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 = "{}/videos/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"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.OK:
|
||||
response_200 = cast(Any, 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.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]]:
|
||||
"""Video Get
|
||||
|
||||
Get a video 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]]:
|
||||
"""Video Get
|
||||
|
||||
Get a video 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]]:
|
||||
"""Video Get
|
||||
|
||||
Get a video 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]]:
|
||||
"""Video Get
|
||||
|
||||
Get a video 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
|
197
photosapi_client/api/default/video_move_videos_id_put.py
Normal file
197
photosapi_client/api/default/video_move_videos_id_put.py
Normal file
@@ -0,0 +1,197 @@
|
||||
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 ...models.video_public import VideoPublic
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/videos/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["album"] = album
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = VideoPublic.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.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, VideoPublic]]:
|
||||
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,
|
||||
album: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Move
|
||||
|
||||
Move a video into another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Move
|
||||
|
||||
Move a video into another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
album: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Move
|
||||
|
||||
Move a video into another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
|
||||
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,
|
||||
album: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Move
|
||||
|
||||
Move a video into another album
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
album (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
album=album,
|
||||
)
|
||||
).parsed
|
197
photosapi_client/api/default/video_patch_videos_id_patch.py
Normal file
197
photosapi_client/api/default/video_patch_videos_id_patch.py
Normal file
@@ -0,0 +1,197 @@
|
||||
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 ...models.video_public import VideoPublic
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/videos/{id}".format(client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["caption"] = caption
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "patch",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Client, response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = VideoPublic.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.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, VideoPublic]]:
|
||||
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,
|
||||
caption: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Patch
|
||||
|
||||
Change properties of a video
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Patch
|
||||
|
||||
Change properties of a video
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
caption: str,
|
||||
) -> Response[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Patch
|
||||
|
||||
Change properties of a video
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
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,
|
||||
caption: str,
|
||||
) -> Optional[Union[Any, HTTPValidationError, VideoPublic]]:
|
||||
"""Video Patch
|
||||
|
||||
Change properties of a video
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
caption (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, VideoPublic]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
caption=caption,
|
||||
)
|
||||
).parsed
|
@@ -0,0 +1,210 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.body_video_upload_albums_album_videos_post import BodyVideoUploadAlbumsAlbumVideosPost
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.video import Video
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/albums/{album}/videos".format(client.base_url, album=album)
|
||||
|
||||
headers: Dict[str, str] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
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}
|
||||
|
||||
multipart_multipart_data = multipart_data.to_multipart()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"files": multipart_multipart_data,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
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.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, Video]]:
|
||||
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,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Response[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
Upload a video to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Video]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
Upload a video to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Video]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
caption=caption,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Response[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
Upload a video to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Video]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
caption=caption,
|
||||
)
|
||||
|
||||
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(
|
||||
album: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
multipart_data: BodyVideoUploadAlbumsAlbumVideosPost,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
) -> Optional[Union[Any, HTTPValidationError, Video]]:
|
||||
"""Video Upload
|
||||
|
||||
Upload a video to album
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
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.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Video]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
album=album,
|
||||
client=client,
|
||||
multipart_data=multipart_data,
|
||||
caption=caption,
|
||||
)
|
||||
).parsed
|
Reference in New Issue
Block a user