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,204 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.event import Event
from ...types import Response
def _get_kwargs(
id: int,
*,
body: Union[
Event,
Event,
Event,
],
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "post",
"url": f"/api/v2/events/events/{id}/actions/duplicate/",
}
if isinstance(body, Event):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, Event):
_kwargs["data"] = body.to_dict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, Event):
_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[Event]:
if response.status_code == 200:
response_200 = Event.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[Event]:
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[
Event,
Event,
Event,
],
) -> Response[Event]:
"""Duplicate an event, its active modules and all configurations
Args:
id (int):
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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[Event]
"""
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[
Event,
Event,
Event,
],
) -> Optional[Event]:
"""Duplicate an event, its active modules and all configurations
Args:
id (int):
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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:
Event
"""
return sync_detailed(
id=id,
client=client,
body=body,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
body: Union[
Event,
Event,
Event,
],
) -> Response[Event]:
"""Duplicate an event, its active modules and all configurations
Args:
id (int):
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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[Event]
"""
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[
Event,
Event,
Event,
],
) -> Optional[Event]:
"""Duplicate an event, its active modules and all configurations
Args:
id (int):
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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:
Event
"""
return (
await asyncio_detailed(
id=id,
client=client,
body=body,
)
).parsed
@@ -0,0 +1,244 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.event import Event
from ...models.events_events_actions_export_create_file_type import EventsEventsActionsExportCreateFileType
from ...types import UNSET, Response, Unset
def _get_kwargs(
id: int,
*,
body: Union[
Event,
Event,
Event,
],
file_type: Union[Unset, EventsEventsActionsExportCreateFileType] = EventsEventsActionsExportCreateFileType.XLSX,
testing: Union[Unset, bool] = False,
) -> dict[str, Any]:
headers: dict[str, Any] = {}
params: dict[str, Any] = {}
json_file_type: Union[Unset, str] = UNSET
if not isinstance(file_type, Unset):
json_file_type = file_type.value
params["file_type"] = json_file_type
params["testing"] = testing
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
_kwargs: dict[str, Any] = {
"method": "post",
"url": f"/api/v2/events/events/{id}/actions/export/",
"params": params,
}
if isinstance(body, Event):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, Event):
_kwargs["data"] = body.to_dict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, Event):
_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[Event]:
if response.status_code == 200:
response_200 = Event.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[Event]:
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[
Event,
Event,
Event,
],
file_type: Union[Unset, EventsEventsActionsExportCreateFileType] = EventsEventsActionsExportCreateFileType.XLSX,
testing: Union[Unset, bool] = False,
) -> Response[Event]:
"""
Args:
id (int):
file_type (Union[Unset, EventsEventsActionsExportCreateFileType]): Default:
EventsEventsActionsExportCreateFileType.XLSX.
testing (Union[Unset, bool]): Default: False.
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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[Event]
"""
kwargs = _get_kwargs(
id=id,
body=body,
file_type=file_type,
testing=testing,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
id: int,
*,
client: AuthenticatedClient,
body: Union[
Event,
Event,
Event,
],
file_type: Union[Unset, EventsEventsActionsExportCreateFileType] = EventsEventsActionsExportCreateFileType.XLSX,
testing: Union[Unset, bool] = False,
) -> Optional[Event]:
"""
Args:
id (int):
file_type (Union[Unset, EventsEventsActionsExportCreateFileType]): Default:
EventsEventsActionsExportCreateFileType.XLSX.
testing (Union[Unset, bool]): Default: False.
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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:
Event
"""
return sync_detailed(
id=id,
client=client,
body=body,
file_type=file_type,
testing=testing,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
body: Union[
Event,
Event,
Event,
],
file_type: Union[Unset, EventsEventsActionsExportCreateFileType] = EventsEventsActionsExportCreateFileType.XLSX,
testing: Union[Unset, bool] = False,
) -> Response[Event]:
"""
Args:
id (int):
file_type (Union[Unset, EventsEventsActionsExportCreateFileType]): Default:
EventsEventsActionsExportCreateFileType.XLSX.
testing (Union[Unset, bool]): Default: False.
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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[Event]
"""
kwargs = _get_kwargs(
id=id,
body=body,
file_type=file_type,
testing=testing,
)
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[
Event,
Event,
Event,
],
file_type: Union[Unset, EventsEventsActionsExportCreateFileType] = EventsEventsActionsExportCreateFileType.XLSX,
testing: Union[Unset, bool] = False,
) -> Optional[Event]:
"""
Args:
id (int):
file_type (Union[Unset, EventsEventsActionsExportCreateFileType]): Default:
EventsEventsActionsExportCreateFileType.XLSX.
testing (Union[Unset, bool]): Default: False.
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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:
Event
"""
return (
await asyncio_detailed(
id=id,
client=client,
body=body,
file_type=file_type,
testing=testing,
)
).parsed
@@ -0,0 +1,146 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.event_moderation import EventModeration
from ...types import Response
def _get_kwargs(
id: int,
*,
body: Union[
EventModeration,
EventModeration,
EventModeration,
],
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "post",
"url": f"/api/v2/events/events/{id}/actions/moderate/",
}
if isinstance(body, EventModeration):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, EventModeration):
_kwargs["data"] = body.to_dict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, EventModeration):
_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[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,
body: Union[
EventModeration,
EventModeration,
EventModeration,
],
) -> Response[Any]:
"""Action from the PolyTicket team to moderate an event.
If the event is valid: change moderation_status to validated and send an email to the organisers to
notify them of the validation.
Else: change moderation_status to change_requested and send an email to the organisers to ask for
necessary changes.
Args:
id (int):
body (EventModeration): Write only serializer, used by admin to validate an event.
body (EventModeration): Write only serializer, used by admin to validate an event.
body (EventModeration): Write only serializer, used by admin to validate an event.
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,
body=body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
body: Union[
EventModeration,
EventModeration,
EventModeration,
],
) -> Response[Any]:
"""Action from the PolyTicket team to moderate an event.
If the event is valid: change moderation_status to validated and send an email to the organisers to
notify them of the validation.
Else: change moderation_status to change_requested and send an email to the organisers to ask for
necessary changes.
Args:
id (int):
body (EventModeration): Write only serializer, used by admin to validate an event.
body (EventModeration): Write only serializer, used by admin to validate an event.
body (EventModeration): Write only serializer, used by admin to validate an event.
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,
body=body,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
@@ -0,0 +1,184 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.node_stock import NodeStock
from ...types import UNSET, Response, Unset
def _get_kwargs(
id: int,
*,
testing: Union[Unset, bool] = False,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["testing"] = testing
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": f"/api/v2/events/events/{id}/actions/node_stocks/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[list["NodeStock"]]:
if response.status_code == 200:
response_200 = []
_response_200 = response.json()
for response_200_item_data in _response_200:
response_200_item = NodeStock.from_dict(response_200_item_data)
response_200.append(response_200_item)
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[list["NodeStock"]]:
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,
testing: Union[Unset, bool] = False,
) -> Response[list["NodeStock"]]:
"""This endpoint returns an overview of what has been consumed of the event so far, and how many items
remain, when applicable. Each object of the response represents one node, with related usage
information and limits
Args:
id (int):
testing (Union[Unset, bool]): Default: False.
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[list['NodeStock']]
"""
kwargs = _get_kwargs(
id=id,
testing=testing,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
id: int,
*,
client: AuthenticatedClient,
testing: Union[Unset, bool] = False,
) -> Optional[list["NodeStock"]]:
"""This endpoint returns an overview of what has been consumed of the event so far, and how many items
remain, when applicable. Each object of the response represents one node, with related usage
information and limits
Args:
id (int):
testing (Union[Unset, bool]): Default: False.
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:
list['NodeStock']
"""
return sync_detailed(
id=id,
client=client,
testing=testing,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
testing: Union[Unset, bool] = False,
) -> Response[list["NodeStock"]]:
"""This endpoint returns an overview of what has been consumed of the event so far, and how many items
remain, when applicable. Each object of the response represents one node, with related usage
information and limits
Args:
id (int):
testing (Union[Unset, bool]): Default: False.
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[list['NodeStock']]
"""
kwargs = _get_kwargs(
id=id,
testing=testing,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
id: int,
*,
client: AuthenticatedClient,
testing: Union[Unset, bool] = False,
) -> Optional[list["NodeStock"]]:
"""This endpoint returns an overview of what has been consumed of the event so far, and how many items
remain, when applicable. Each object of the response represents one node, with related usage
information and limits
Args:
id (int):
testing (Union[Unset, bool]): Default: False.
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:
list['NodeStock']
"""
return (
await asyncio_detailed(
id=id,
client=client,
testing=testing,
)
).parsed
@@ -0,0 +1,167 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.event_public_infos import EventPublicInfos
from ...types import UNSET, Response
def _get_kwargs(
frontend_path: str,
*,
testing: bool,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["testing"] = testing
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": f"/api/v2/events/events/actions/public_infos/{frontend_path}/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[EventPublicInfos]:
if response.status_code == 200:
response_200 = EventPublicInfos.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[EventPublicInfos]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
frontend_path: str,
*,
client: AuthenticatedClient,
testing: bool,
) -> Response[EventPublicInfos]:
"""
Args:
frontend_path (str):
testing (bool):
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[EventPublicInfos]
"""
kwargs = _get_kwargs(
frontend_path=frontend_path,
testing=testing,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
frontend_path: str,
*,
client: AuthenticatedClient,
testing: bool,
) -> Optional[EventPublicInfos]:
"""
Args:
frontend_path (str):
testing (bool):
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:
EventPublicInfos
"""
return sync_detailed(
frontend_path=frontend_path,
client=client,
testing=testing,
).parsed
async def asyncio_detailed(
frontend_path: str,
*,
client: AuthenticatedClient,
testing: bool,
) -> Response[EventPublicInfos]:
"""
Args:
frontend_path (str):
testing (bool):
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[EventPublicInfos]
"""
kwargs = _get_kwargs(
frontend_path=frontend_path,
testing=testing,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
frontend_path: str,
*,
client: AuthenticatedClient,
testing: bool,
) -> Optional[EventPublicInfos]:
"""
Args:
frontend_path (str):
testing (bool):
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:
EventPublicInfos
"""
return (
await asyncio_detailed(
frontend_path=frontend_path,
client=client,
testing=testing,
)
).parsed
@@ -0,0 +1,95 @@
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": "post",
"url": f"/api/v2/events/events/{id}/actions/request_moderation/",
}
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]:
"""Action to request moderation from the PolyTicket team on an event. Send a mail to PolyTicket with
all necessary information and change moderation_status to requested.
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]:
"""Action to request moderation from the PolyTicket team on an event. Send a mail to PolyTicket with
all necessary information and change moderation_status to requested.
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,264 @@
import datetime
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.event_statistics import EventStatistics
from ...models.events_events_actions_statistics_retrieve_granularity import (
EventsEventsActionsStatisticsRetrieveGranularity,
)
from ...types import UNSET, Response, Unset
def _get_kwargs(
id: int,
*,
granularity: Union[
Unset, EventsEventsActionsStatisticsRetrieveGranularity
] = EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP,
interval_end: Union[Unset, datetime.datetime] = UNSET,
interval_start: Union[Unset, datetime.datetime] = UNSET,
testing: Union[Unset, bool] = False,
) -> dict[str, Any]:
params: dict[str, Any] = {}
json_granularity: Union[Unset, str] = UNSET
if not isinstance(granularity, Unset):
json_granularity = granularity.value
params["granularity"] = json_granularity
json_interval_end: Union[Unset, str] = UNSET
if not isinstance(interval_end, Unset):
json_interval_end = interval_end.isoformat()
params["interval_end"] = json_interval_end
json_interval_start: Union[Unset, str] = UNSET
if not isinstance(interval_start, Unset):
json_interval_start = interval_start.isoformat()
params["interval_start"] = json_interval_start
params["testing"] = testing
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": f"/api/v2/events/events/{id}/actions/statistics/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[EventStatistics]:
if response.status_code == 200:
response_200 = EventStatistics.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[EventStatistics]:
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,
granularity: Union[
Unset, EventsEventsActionsStatisticsRetrieveGranularity
] = EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP,
interval_end: Union[Unset, datetime.datetime] = UNSET,
interval_start: Union[Unset, datetime.datetime] = UNSET,
testing: Union[Unset, bool] = False,
) -> Response[EventStatistics]:
"""Get event statistics by chosen granularity. Please note that data isn't sorted in chronological
order within the different dicts.
Includes all data after `interval_start`, adding a point at `interval_start` with the last known
value before it (or 0 if none).
Includes all data before `interval_end`, adding a point at `interval_end` with the next available
value (or the last known value if none).
Args:
id (int):
granularity (Union[Unset, EventsEventsActionsStatisticsRetrieveGranularity]): Default:
EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP.
interval_end (Union[Unset, datetime.datetime]):
interval_start (Union[Unset, datetime.datetime]):
testing (Union[Unset, bool]): Default: False.
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[EventStatistics]
"""
kwargs = _get_kwargs(
id=id,
granularity=granularity,
interval_end=interval_end,
interval_start=interval_start,
testing=testing,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
id: int,
*,
client: AuthenticatedClient,
granularity: Union[
Unset, EventsEventsActionsStatisticsRetrieveGranularity
] = EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP,
interval_end: Union[Unset, datetime.datetime] = UNSET,
interval_start: Union[Unset, datetime.datetime] = UNSET,
testing: Union[Unset, bool] = False,
) -> Optional[EventStatistics]:
"""Get event statistics by chosen granularity. Please note that data isn't sorted in chronological
order within the different dicts.
Includes all data after `interval_start`, adding a point at `interval_start` with the last known
value before it (or 0 if none).
Includes all data before `interval_end`, adding a point at `interval_end` with the next available
value (or the last known value if none).
Args:
id (int):
granularity (Union[Unset, EventsEventsActionsStatisticsRetrieveGranularity]): Default:
EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP.
interval_end (Union[Unset, datetime.datetime]):
interval_start (Union[Unset, datetime.datetime]):
testing (Union[Unset, bool]): Default: False.
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:
EventStatistics
"""
return sync_detailed(
id=id,
client=client,
granularity=granularity,
interval_end=interval_end,
interval_start=interval_start,
testing=testing,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
granularity: Union[
Unset, EventsEventsActionsStatisticsRetrieveGranularity
] = EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP,
interval_end: Union[Unset, datetime.datetime] = UNSET,
interval_start: Union[Unset, datetime.datetime] = UNSET,
testing: Union[Unset, bool] = False,
) -> Response[EventStatistics]:
"""Get event statistics by chosen granularity. Please note that data isn't sorted in chronological
order within the different dicts.
Includes all data after `interval_start`, adding a point at `interval_start` with the last known
value before it (or 0 if none).
Includes all data before `interval_end`, adding a point at `interval_end` with the next available
value (or the last known value if none).
Args:
id (int):
granularity (Union[Unset, EventsEventsActionsStatisticsRetrieveGranularity]): Default:
EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP.
interval_end (Union[Unset, datetime.datetime]):
interval_start (Union[Unset, datetime.datetime]):
testing (Union[Unset, bool]): Default: False.
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[EventStatistics]
"""
kwargs = _get_kwargs(
id=id,
granularity=granularity,
interval_end=interval_end,
interval_start=interval_start,
testing=testing,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
id: int,
*,
client: AuthenticatedClient,
granularity: Union[
Unset, EventsEventsActionsStatisticsRetrieveGranularity
] = EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP,
interval_end: Union[Unset, datetime.datetime] = UNSET,
interval_start: Union[Unset, datetime.datetime] = UNSET,
testing: Union[Unset, bool] = False,
) -> Optional[EventStatistics]:
"""Get event statistics by chosen granularity. Please note that data isn't sorted in chronological
order within the different dicts.
Includes all data after `interval_start`, adding a point at `interval_start` with the last known
value before it (or 0 if none).
Includes all data before `interval_end`, adding a point at `interval_end` with the next available
value (or the last known value if none).
Args:
id (int):
granularity (Union[Unset, EventsEventsActionsStatisticsRetrieveGranularity]): Default:
EventsEventsActionsStatisticsRetrieveGranularity.TIMESTAMP.
interval_end (Union[Unset, datetime.datetime]):
interval_start (Union[Unset, datetime.datetime]):
testing (Union[Unset, bool]): Default: False.
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:
EventStatistics
"""
return (
await asyncio_detailed(
id=id,
client=client,
granularity=granularity,
interval_end=interval_end,
interval_start=interval_start,
testing=testing,
)
).parsed
@@ -0,0 +1,190 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.ticket_office_infos import TicketOfficeInfos
from ...types import UNSET, Response, Unset
def _get_kwargs(
id: int,
*,
frontend_basket: int,
node_selected_ids: Union[Unset, list[float]] = UNSET,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["frontend_basket"] = frontend_basket
json_node_selected_ids: Union[Unset, list[float]] = UNSET
if not isinstance(node_selected_ids, Unset):
json_node_selected_ids = node_selected_ids
params["node_selected_ids"] = json_node_selected_ids
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": f"/api/v2/events/events/{id}/actions/ticket_office_infos/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[TicketOfficeInfos]:
if response.status_code == 200:
response_200 = TicketOfficeInfos.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[TicketOfficeInfos]:
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,
frontend_basket: int,
node_selected_ids: Union[Unset, list[float]] = UNSET,
) -> Response[TicketOfficeInfos]:
"""Get all infos related to an Event, filtered based on Conditions
Args:
id (int):
frontend_basket (int):
node_selected_ids (Union[Unset, list[float]]):
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[TicketOfficeInfos]
"""
kwargs = _get_kwargs(
id=id,
frontend_basket=frontend_basket,
node_selected_ids=node_selected_ids,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
id: int,
*,
client: AuthenticatedClient,
frontend_basket: int,
node_selected_ids: Union[Unset, list[float]] = UNSET,
) -> Optional[TicketOfficeInfos]:
"""Get all infos related to an Event, filtered based on Conditions
Args:
id (int):
frontend_basket (int):
node_selected_ids (Union[Unset, list[float]]):
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:
TicketOfficeInfos
"""
return sync_detailed(
id=id,
client=client,
frontend_basket=frontend_basket,
node_selected_ids=node_selected_ids,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
frontend_basket: int,
node_selected_ids: Union[Unset, list[float]] = UNSET,
) -> Response[TicketOfficeInfos]:
"""Get all infos related to an Event, filtered based on Conditions
Args:
id (int):
frontend_basket (int):
node_selected_ids (Union[Unset, list[float]]):
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[TicketOfficeInfos]
"""
kwargs = _get_kwargs(
id=id,
frontend_basket=frontend_basket,
node_selected_ids=node_selected_ids,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
id: int,
*,
client: AuthenticatedClient,
frontend_basket: int,
node_selected_ids: Union[Unset, list[float]] = UNSET,
) -> Optional[TicketOfficeInfos]:
"""Get all infos related to an Event, filtered based on Conditions
Args:
id (int):
frontend_basket (int):
node_selected_ids (Union[Unset, list[float]]):
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:
TicketOfficeInfos
"""
return (
await asyncio_detailed(
id=id,
client=client,
frontend_basket=frontend_basket,
node_selected_ids=node_selected_ids,
)
).parsed
@@ -0,0 +1,187 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.event import Event
from ...types import Response
def _get_kwargs(
*,
body: Union[
Event,
Event,
Event,
],
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/api/v2/events/events/",
}
if isinstance(body, Event):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, Event):
_kwargs["data"] = body.to_dict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, Event):
_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[Event]:
if response.status_code == 201:
response_201 = Event.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[Event]:
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[
Event,
Event,
Event,
],
) -> Response[Event]:
"""
Args:
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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[Event]
"""
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[
Event,
Event,
Event,
],
) -> Optional[Event]:
"""
Args:
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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:
Event
"""
return sync_detailed(
client=client,
body=body,
).parsed
async def asyncio_detailed(
*,
client: AuthenticatedClient,
body: Union[
Event,
Event,
Event,
],
) -> Response[Event]:
"""
Args:
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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[Event]
"""
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[
Event,
Event,
Event,
],
) -> Optional[Event]:
"""
Args:
body (Event): Serializer for Node model
body (Event): Serializer for Node model
body (Event): Serializer for Node model
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:
Event
"""
return (
await asyncio_detailed(
client=client,
body=body,
)
).parsed
@@ -0,0 +1,91 @@
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/events/events/{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]:
"""
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]:
"""
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,214 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.paginated_event_list import PaginatedEventList
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,
unit: Union[Unset, int] = UNSET,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["o"] = o
params["offset"] = offset
params["page_limit"] = page_limit
params["q"] = q
params["unit"] = unit
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/events/events/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[PaginatedEventList]:
if response.status_code == 200:
response_200 = PaginatedEventList.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[PaginatedEventList]:
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,
unit: Union[Unset, int] = UNSET,
) -> Response[PaginatedEventList]:
"""
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, str]):
unit (Union[Unset, 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[PaginatedEventList]
"""
kwargs = _get_kwargs(
o=o,
offset=offset,
page_limit=page_limit,
q=q,
unit=unit,
)
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,
unit: Union[Unset, int] = UNSET,
) -> Optional[PaginatedEventList]:
"""
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, str]):
unit (Union[Unset, 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:
PaginatedEventList
"""
return sync_detailed(
client=client,
o=o,
offset=offset,
page_limit=page_limit,
q=q,
unit=unit,
).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,
unit: Union[Unset, int] = UNSET,
) -> Response[PaginatedEventList]:
"""
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, str]):
unit (Union[Unset, 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[PaginatedEventList]
"""
kwargs = _get_kwargs(
o=o,
offset=offset,
page_limit=page_limit,
q=q,
unit=unit,
)
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,
unit: Union[Unset, int] = UNSET,
) -> Optional[PaginatedEventList]:
"""
Args:
o (Union[Unset, str]):
offset (Union[Unset, int]):
page_limit (Union[Unset, int]):
q (Union[Unset, str]):
unit (Union[Unset, 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:
PaginatedEventList
"""
return (
await asyncio_detailed(
client=client,
o=o,
offset=offset,
page_limit=page_limit,
q=q,
unit=unit,
)
).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.event import Event
from ...models.patched_event import PatchedEvent
from ...types import Response
def _get_kwargs(
id: int,
*,
body: Union[
PatchedEvent,
PatchedEvent,
PatchedEvent,
],
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "patch",
"url": f"/api/v2/events/events/{id}/",
}
if isinstance(body, PatchedEvent):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, PatchedEvent):
_kwargs["data"] = body.to_dict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, PatchedEvent):
_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[Event]:
if response.status_code == 200:
response_200 = Event.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[Event]:
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[
PatchedEvent,
PatchedEvent,
PatchedEvent,
],
) -> Response[Event]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
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[Event]
"""
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[
PatchedEvent,
PatchedEvent,
PatchedEvent,
],
) -> Optional[Event]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
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:
Event
"""
return sync_detailed(
id=id,
client=client,
body=body,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
body: Union[
PatchedEvent,
PatchedEvent,
PatchedEvent,
],
) -> Response[Event]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
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[Event]
"""
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[
PatchedEvent,
PatchedEvent,
PatchedEvent,
],
) -> Optional[Event]:
"""Partial update (PATCH) definition
Returns:
response: the serialized data
Args:
id (int):
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
body (PatchedEvent): Serializer for Node model
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:
Event
"""
return (
await asyncio_detailed(
id=id,
client=client,
body=body,
)
).parsed
@@ -0,0 +1,142 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.event import Event
from ...types import Response
def _get_kwargs(
id: int,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/api/v2/events/events/{id}/",
}
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Event]:
if response.status_code == 200:
response_200 = Event.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[Event]:
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[Event]:
"""
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[Event]
"""
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[Event]:
"""
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:
Event
"""
return sync_detailed(
id=id,
client=client,
).parsed
async def asyncio_detailed(
id: int,
*,
client: AuthenticatedClient,
) -> Response[Event]:
"""
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[Event]
"""
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[Event]:
"""
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:
Event
"""
return (
await asyncio_detailed(
id=id,
client=client,
)
).parsed