add openapi-python-client generator + client

This commit is contained in:
2025-07-11 12:00:23 +02:00
parent 6910cf37f2
commit 1cc7d01c27
485 changed files with 72495 additions and 0 deletions
@@ -0,0 +1 @@
"""Contains endpoint functions for accessing the API"""
@@ -0,0 +1,211 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.uploaded_image import UploadedImage
from ...types import Response
def _get_kwargs(
*,
body: Union[
UploadedImage,
UploadedImage,
UploadedImage,
],
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/api/v2/common/uploaded_images/",
}
if isinstance(body, UploadedImage):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, UploadedImage):
_kwargs["data"] = body.to_dict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, UploadedImage):
_kwargs["files"] = body.to_multipart()
headers["Content-Type"] = "multipart/form-data"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UploadedImage]:
if response.status_code == 201:
response_201 = UploadedImage.from_dict(response.json())
return response_201
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UploadedImage]:
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,
body: Union[
UploadedImage,
UploadedImage,
UploadedImage,
],
) -> Response[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
body (UploadedImage):
body (UploadedImage):
body (UploadedImage):
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[UploadedImage]
"""
kwargs = _get_kwargs(
body=body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
*,
client: AuthenticatedClient,
body: Union[
UploadedImage,
UploadedImage,
UploadedImage,
],
) -> Optional[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
body (UploadedImage):
body (UploadedImage):
body (UploadedImage):
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:
UploadedImage
"""
return sync_detailed(
client=client,
body=body,
).parsed
async def asyncio_detailed(
*,
client: AuthenticatedClient,
body: Union[
UploadedImage,
UploadedImage,
UploadedImage,
],
) -> Response[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
body (UploadedImage):
body (UploadedImage):
body (UploadedImage):
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[UploadedImage]
"""
kwargs = _get_kwargs(
body=body,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
*,
client: AuthenticatedClient,
body: Union[
UploadedImage,
UploadedImage,
UploadedImage,
],
) -> Optional[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
body (UploadedImage):
body (UploadedImage):
body (UploadedImage):
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:
UploadedImage
"""
return (
await asyncio_detailed(
client=client,
body=body,
)
).parsed
@@ -0,0 +1,103 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import Response
def _get_kwargs(
id: int,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "delete",
"url": f"/api/v2/common/uploaded_images/{id}/",
}
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == 204:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
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: int,
*,
client: AuthenticatedClient,
) -> Response[Any]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
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[Any]
"""
kwargs = _get_kwargs(
id=id,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
) -> Response[Any]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
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[Any]
"""
kwargs = _get_kwargs(
id=id,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
@@ -0,0 +1,223 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.paginated_uploaded_image_list import PaginatedUploadedImageList
from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
o: Union[Unset, str] = UNSET,
offset: Union[Unset, int] = UNSET,
page_limit: Union[Unset, int] = UNSET,
q: Union[Unset, str] = UNSET,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["o"] = o
params["offset"] = offset
params["page_limit"] = page_limit
params["q"] = q
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/api/v2/common/uploaded_images/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[PaginatedUploadedImageList]:
if response.status_code == 200:
response_200 = PaginatedUploadedImageList.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[PaginatedUploadedImageList]:
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,
o: Union[Unset, str] = UNSET,
offset: Union[Unset, int] = UNSET,
page_limit: Union[Unset, int] = UNSET,
q: Union[Unset, str] = UNSET,
) -> Response[PaginatedUploadedImageList]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, 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[PaginatedUploadedImageList]
"""
kwargs = _get_kwargs(
o=o,
offset=offset,
page_limit=page_limit,
q=q,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
*,
client: AuthenticatedClient,
o: Union[Unset, str] = UNSET,
offset: Union[Unset, int] = UNSET,
page_limit: Union[Unset, int] = UNSET,
q: Union[Unset, str] = UNSET,
) -> Optional[PaginatedUploadedImageList]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, 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:
PaginatedUploadedImageList
"""
return sync_detailed(
client=client,
o=o,
offset=offset,
page_limit=page_limit,
q=q,
).parsed
async def asyncio_detailed(
*,
client: AuthenticatedClient,
o: Union[Unset, str] = UNSET,
offset: Union[Unset, int] = UNSET,
page_limit: Union[Unset, int] = UNSET,
q: Union[Unset, str] = UNSET,
) -> Response[PaginatedUploadedImageList]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, 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[PaginatedUploadedImageList]
"""
kwargs = _get_kwargs(
o=o,
offset=offset,
page_limit=page_limit,
q=q,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
*,
client: AuthenticatedClient,
o: Union[Unset, str] = UNSET,
offset: Union[Unset, int] = UNSET,
page_limit: Union[Unset, int] = UNSET,
q: Union[Unset, str] = UNSET,
) -> Optional[PaginatedUploadedImageList]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, 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:
PaginatedUploadedImageList
"""
return (
await asyncio_detailed(
client=client,
o=o,
offset=offset,
page_limit=page_limit,
q=q,
)
).parsed
@@ -0,0 +1,213 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.patched_uploaded_image import PatchedUploadedImage
from ...models.uploaded_image import UploadedImage
from ...types import Response
def _get_kwargs(
id: int,
*,
body: Union[
PatchedUploadedImage,
PatchedUploadedImage,
PatchedUploadedImage,
],
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "patch",
"url": f"/api/v2/common/uploaded_images/{id}/",
}
if isinstance(body, PatchedUploadedImage):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, PatchedUploadedImage):
_kwargs["data"] = body.to_dict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, PatchedUploadedImage):
_kwargs["files"] = body.to_multipart()
headers["Content-Type"] = "multipart/form-data"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UploadedImage]:
if response.status_code == 200:
response_200 = UploadedImage.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UploadedImage]:
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: int,
*,
client: AuthenticatedClient,
body: Union[
PatchedUploadedImage,
PatchedUploadedImage,
PatchedUploadedImage,
],
) -> Response[UploadedImage]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
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[UploadedImage]
"""
kwargs = _get_kwargs(
id=id,
body=body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
id: int,
*,
client: AuthenticatedClient,
body: Union[
PatchedUploadedImage,
PatchedUploadedImage,
PatchedUploadedImage,
],
) -> Optional[UploadedImage]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
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:
UploadedImage
"""
return sync_detailed(
id=id,
client=client,
body=body,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
body: Union[
PatchedUploadedImage,
PatchedUploadedImage,
PatchedUploadedImage,
],
) -> Response[UploadedImage]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
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[UploadedImage]
"""
kwargs = _get_kwargs(
id=id,
body=body,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
id: int,
*,
client: AuthenticatedClient,
body: Union[
PatchedUploadedImage,
PatchedUploadedImage,
PatchedUploadedImage,
],
) -> Optional[UploadedImage]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
body (PatchedUploadedImage):
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:
UploadedImage
"""
return (
await asyncio_detailed(
id=id,
client=client,
body=body,
)
).parsed
@@ -0,0 +1,166 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.uploaded_image import UploadedImage
from ...types import Response
def _get_kwargs(
id: int,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/api/v2/common/uploaded_images/{id}/",
}
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UploadedImage]:
if response.status_code == 200:
response_200 = UploadedImage.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UploadedImage]:
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: int,
*,
client: AuthenticatedClient,
) -> Response[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
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[UploadedImage]
"""
kwargs = _get_kwargs(
id=id,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
id: int,
*,
client: AuthenticatedClient,
) -> Optional[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
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:
UploadedImage
"""
return sync_detailed(
id=id,
client=client,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
) -> Response[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
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[UploadedImage]
"""
kwargs = _get_kwargs(
id=id,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
id: int,
*,
client: AuthenticatedClient,
) -> Optional[UploadedImage]:
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
be retrievable without authorization, with event authorization, or with ownership authorization.
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
able to access public images without any authentication. The authentication for restricted image
access is performed with IsJWTAuthenticated in the permission itself.
Args:
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:
UploadedImage
"""
return (
await asyncio_detailed(
id=id,
client=client,
)
).parsed