add openapi-python-client generator + client
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""Contains endpoint functions for accessing the API"""
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.billing_information import BillingInformation
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Union[
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
],
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v2/modules_basket/billing_informations/",
|
||||
}
|
||||
|
||||
if isinstance(body, BillingInformation):
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
if isinstance(body, BillingInformation):
|
||||
_kwargs["data"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
if isinstance(body, BillingInformation):
|
||||
_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[BillingInformation]:
|
||||
if response.status_code == 201:
|
||||
response_201 = BillingInformation.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[BillingInformation]:
|
||||
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[
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
],
|
||||
) -> Response[BillingInformation]:
|
||||
"""
|
||||
Args:
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
|
||||
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[BillingInformation]
|
||||
"""
|
||||
|
||||
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[
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
],
|
||||
) -> Optional[BillingInformation]:
|
||||
"""
|
||||
Args:
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
|
||||
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:
|
||||
BillingInformation
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
],
|
||||
) -> Response[BillingInformation]:
|
||||
"""
|
||||
Args:
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
|
||||
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[BillingInformation]
|
||||
"""
|
||||
|
||||
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[
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
BillingInformation,
|
||||
],
|
||||
) -> Optional[BillingInformation]:
|
||||
"""
|
||||
Args:
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
body (BillingInformation): Serializer for BillingInformation model
|
||||
Requires to be logged in as a user or to provide a frontend login associated with your
|
||||
request
|
||||
|
||||
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:
|
||||
BillingInformation
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
+274
@@ -0,0 +1,274 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_billing_information_list import PaginatedBillingInformationList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
basket_id: Union[Unset, int] = UNSET,
|
||||
created_by: Union[Unset, str] = UNSET,
|
||||
event_id: Union[Unset, float] = UNSET,
|
||||
is_deleted: Union[Unset, bool] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
user: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["basket_id"] = basket_id
|
||||
|
||||
params["created_by"] = created_by
|
||||
|
||||
params["event_id"] = event_id
|
||||
|
||||
params["is_deleted"] = is_deleted
|
||||
|
||||
params["o"] = o
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
params["page_limit"] = page_limit
|
||||
|
||||
params["q"] = q
|
||||
|
||||
params["user"] = user
|
||||
|
||||
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/modules_basket/billing_informations/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedBillingInformationList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedBillingInformationList.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[PaginatedBillingInformationList]:
|
||||
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,
|
||||
basket_id: Union[Unset, int] = UNSET,
|
||||
created_by: Union[Unset, str] = UNSET,
|
||||
event_id: Union[Unset, float] = UNSET,
|
||||
is_deleted: Union[Unset, bool] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
user: Union[Unset, str] = UNSET,
|
||||
) -> Response[PaginatedBillingInformationList]:
|
||||
"""
|
||||
Args:
|
||||
basket_id (Union[Unset, int]):
|
||||
created_by (Union[Unset, str]):
|
||||
event_id (Union[Unset, float]):
|
||||
is_deleted (Union[Unset, bool]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
user (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[PaginatedBillingInformationList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
basket_id=basket_id,
|
||||
created_by=created_by,
|
||||
event_id=event_id,
|
||||
is_deleted=is_deleted,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
user=user,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
basket_id: Union[Unset, int] = UNSET,
|
||||
created_by: Union[Unset, str] = UNSET,
|
||||
event_id: Union[Unset, float] = UNSET,
|
||||
is_deleted: Union[Unset, bool] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
user: Union[Unset, str] = UNSET,
|
||||
) -> Optional[PaginatedBillingInformationList]:
|
||||
"""
|
||||
Args:
|
||||
basket_id (Union[Unset, int]):
|
||||
created_by (Union[Unset, str]):
|
||||
event_id (Union[Unset, float]):
|
||||
is_deleted (Union[Unset, bool]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
user (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:
|
||||
PaginatedBillingInformationList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
basket_id=basket_id,
|
||||
created_by=created_by,
|
||||
event_id=event_id,
|
||||
is_deleted=is_deleted,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
user=user,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
basket_id: Union[Unset, int] = UNSET,
|
||||
created_by: Union[Unset, str] = UNSET,
|
||||
event_id: Union[Unset, float] = UNSET,
|
||||
is_deleted: Union[Unset, bool] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
user: Union[Unset, str] = UNSET,
|
||||
) -> Response[PaginatedBillingInformationList]:
|
||||
"""
|
||||
Args:
|
||||
basket_id (Union[Unset, int]):
|
||||
created_by (Union[Unset, str]):
|
||||
event_id (Union[Unset, float]):
|
||||
is_deleted (Union[Unset, bool]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
user (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[PaginatedBillingInformationList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
basket_id=basket_id,
|
||||
created_by=created_by,
|
||||
event_id=event_id,
|
||||
is_deleted=is_deleted,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
user=user,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
basket_id: Union[Unset, int] = UNSET,
|
||||
created_by: Union[Unset, str] = UNSET,
|
||||
event_id: Union[Unset, float] = UNSET,
|
||||
is_deleted: Union[Unset, bool] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
user: Union[Unset, str] = UNSET,
|
||||
) -> Optional[PaginatedBillingInformationList]:
|
||||
"""
|
||||
Args:
|
||||
basket_id (Union[Unset, int]):
|
||||
created_by (Union[Unset, str]):
|
||||
event_id (Union[Unset, float]):
|
||||
is_deleted (Union[Unset, bool]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
user (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:
|
||||
PaginatedBillingInformationList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
basket_id=basket_id,
|
||||
created_by=created_by,
|
||||
event_id=event_id,
|
||||
is_deleted=is_deleted,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
user=user,
|
||||
)
|
||||
).parsed
|
||||
+146
@@ -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.billing_information import BillingInformation
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/api/v2/modules_basket/billing_informations/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[BillingInformation]:
|
||||
if response.status_code == 200:
|
||||
response_200 = BillingInformation.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[BillingInformation]:
|
||||
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[BillingInformation]:
|
||||
"""
|
||||
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[BillingInformation]
|
||||
"""
|
||||
|
||||
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[BillingInformation]:
|
||||
"""
|
||||
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:
|
||||
BillingInformation
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[BillingInformation]:
|
||||
"""
|
||||
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[BillingInformation]
|
||||
"""
|
||||
|
||||
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[BillingInformation]:
|
||||
"""
|
||||
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:
|
||||
BillingInformation
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.selected_node_creation import SelectedNodeCreation
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
body: Union[
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
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/modules_basket/frontend_baskets/{id}/actions/add_to_basket/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
if isinstance(body, SelectedNodeCreation):
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
if isinstance(body, SelectedNodeCreation):
|
||||
_kwargs["data"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
if isinstance(body, SelectedNodeCreation):
|
||||
_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[SelectedNodeCreation]:
|
||||
if response.status_code == 200:
|
||||
response_200 = SelectedNodeCreation.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[SelectedNodeCreation]:
|
||||
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[
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[SelectedNodeCreation]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
|
||||
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[SelectedNodeCreation]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[SelectedNodeCreation]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
|
||||
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:
|
||||
SelectedNodeCreation
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[SelectedNodeCreation]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
|
||||
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[SelectedNodeCreation]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
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[
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
SelectedNodeCreation,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[SelectedNodeCreation]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
body (SelectedNodeCreation): A serializer used specifically in the add-to-basket process.
|
||||
This serializer allows specifying all properties needed to add one item to the basket,
|
||||
including any extra info (groups).
|
||||
This serializer only needs the pks of Nodes, not of NodeConfigurations, as we can
|
||||
determine them directly in this direction.
|
||||
|
||||
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:
|
||||
SelectedNodeCreation
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
).parsed
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.frontend_basket import FrontendBasket
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
body: Union[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
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/modules_basket/frontend_baskets/{id}/actions/generate_ticket/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
if isinstance(body, FrontendBasket):
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
if isinstance(body, FrontendBasket):
|
||||
_kwargs["data"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
if isinstance(body, FrontendBasket):
|
||||
_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[FrontendBasket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = FrontendBasket.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[FrontendBasket]:
|
||||
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[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
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[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
).parsed
|
||||
+256
@@ -0,0 +1,256 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.selected_node_deletion import SelectedNodeDeletion
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
body: Union[
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
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/modules_basket/frontend_baskets/{id}/actions/remove_from_basket/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
if isinstance(body, SelectedNodeDeletion):
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
if isinstance(body, SelectedNodeDeletion):
|
||||
_kwargs["data"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
if isinstance(body, SelectedNodeDeletion):
|
||||
_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[SelectedNodeDeletion]:
|
||||
if response.status_code == 200:
|
||||
response_200 = SelectedNodeDeletion.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[SelectedNodeDeletion]:
|
||||
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[
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[SelectedNodeDeletion]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
|
||||
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[SelectedNodeDeletion]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[SelectedNodeDeletion]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
|
||||
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:
|
||||
SelectedNodeDeletion
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[SelectedNodeDeletion]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
|
||||
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[SelectedNodeDeletion]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
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[
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
SelectedNodeDeletion,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[SelectedNodeDeletion]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
body (SelectedNodeDeletion): A serializer used specifically in the remove-from-basket
|
||||
process. This serializer takes only the id of the selected node to delete. The selected
|
||||
node must currently be in the basket's registrations.
|
||||
|
||||
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:
|
||||
SelectedNodeDeletion
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
).parsed
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.modules_basket_frontend_baskets_actions_validate_extra_infos_retrieve_inline_type import (
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType,
|
||||
)
|
||||
from ...models.selected_node_extra_info import SelectedNodeExtraInfo
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
inline_type: Union[
|
||||
Unset, ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType
|
||||
] = ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
json_inline_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(inline_type, Unset):
|
||||
json_inline_type = inline_type.value
|
||||
|
||||
params["inline_type"] = json_inline_type
|
||||
|
||||
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/modules_basket/frontend_baskets/{id}/actions/validate_extra_infos/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[SelectedNodeExtraInfo]:
|
||||
if response.status_code == 200:
|
||||
response_200 = SelectedNodeExtraInfo.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[SelectedNodeExtraInfo]:
|
||||
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,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
inline_type: Union[
|
||||
Unset, ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType
|
||||
] = ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL,
|
||||
) -> Response[SelectedNodeExtraInfo]:
|
||||
"""Ensures that all required extra info fields have been filled. Returns the `SelectedNodeExtraInfos`
|
||||
that are required but have no value, and an empty JSON if everything is correct.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
inline_type (Union[Unset,
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType]): Default:
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL.
|
||||
|
||||
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[SelectedNodeExtraInfo]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
expand=expand,
|
||||
inline_type=inline_type,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
inline_type: Union[
|
||||
Unset, ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType
|
||||
] = ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL,
|
||||
) -> Optional[SelectedNodeExtraInfo]:
|
||||
"""Ensures that all required extra info fields have been filled. Returns the `SelectedNodeExtraInfos`
|
||||
that are required but have no value, and an empty JSON if everything is correct.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
inline_type (Union[Unset,
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType]): Default:
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL.
|
||||
|
||||
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:
|
||||
SelectedNodeExtraInfo
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
expand=expand,
|
||||
inline_type=inline_type,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
inline_type: Union[
|
||||
Unset, ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType
|
||||
] = ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL,
|
||||
) -> Response[SelectedNodeExtraInfo]:
|
||||
"""Ensures that all required extra info fields have been filled. Returns the `SelectedNodeExtraInfos`
|
||||
that are required but have no value, and an empty JSON if everything is correct.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
inline_type (Union[Unset,
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType]): Default:
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL.
|
||||
|
||||
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[SelectedNodeExtraInfo]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
expand=expand,
|
||||
inline_type=inline_type,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
inline_type: Union[
|
||||
Unset, ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType
|
||||
] = ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL,
|
||||
) -> Optional[SelectedNodeExtraInfo]:
|
||||
"""Ensures that all required extra info fields have been filled. Returns the `SelectedNodeExtraInfos`
|
||||
that are required but have no value, and an empty JSON if everything is correct.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
inline_type (Union[Unset,
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType]): Default:
|
||||
ModulesBasketFrontendBasketsActionsValidateExtraInfosRetrieveInlineType.ALL.
|
||||
|
||||
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:
|
||||
SelectedNodeExtraInfo
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
expand=expand,
|
||||
inline_type=inline_type,
|
||||
)
|
||||
).parsed
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.frontend_basket import FrontendBasket
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Union[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
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": "/api/v2/modules_basket/frontend_baskets/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
if isinstance(body, FrontendBasket):
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
if isinstance(body, FrontendBasket):
|
||||
_kwargs["data"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
if isinstance(body, FrontendBasket):
|
||||
_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[FrontendBasket]:
|
||||
if response.status_code == 201:
|
||||
response_201 = FrontendBasket.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[FrontendBasket]:
|
||||
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[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
FrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
expand (Union[Unset, str]):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
body (FrontendBasket):
|
||||
|
||||
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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
).parsed
|
||||
+282
@@ -0,0 +1,282 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_frontend_basket_list import PaginatedFrontendBasketList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
created_by_id: Union[Unset, int] = UNSET,
|
||||
event: Union[Unset, int] = UNSET,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
status: Union[Unset, str] = UNSET,
|
||||
testing: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["created_by_id"] = created_by_id
|
||||
|
||||
params["event"] = event
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
params["o"] = o
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
params["page_limit"] = page_limit
|
||||
|
||||
params["q"] = q
|
||||
|
||||
params["status"] = status
|
||||
|
||||
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": "/api/v2/modules_basket/frontend_baskets/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedFrontendBasketList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedFrontendBasketList.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[PaginatedFrontendBasketList]:
|
||||
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,
|
||||
created_by_id: Union[Unset, int] = UNSET,
|
||||
event: Union[Unset, int] = UNSET,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
status: Union[Unset, str] = UNSET,
|
||||
testing: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedFrontendBasketList]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
created_by_id (Union[Unset, int]):
|
||||
event (Union[Unset, int]):
|
||||
expand (Union[Unset, str]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
status (Union[Unset, str]):
|
||||
testing (Union[Unset, 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[PaginatedFrontendBasketList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
created_by_id=created_by_id,
|
||||
event=event,
|
||||
expand=expand,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
status=status,
|
||||
testing=testing,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
created_by_id: Union[Unset, int] = UNSET,
|
||||
event: Union[Unset, int] = UNSET,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
status: Union[Unset, str] = UNSET,
|
||||
testing: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedFrontendBasketList]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
created_by_id (Union[Unset, int]):
|
||||
event (Union[Unset, int]):
|
||||
expand (Union[Unset, str]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
status (Union[Unset, str]):
|
||||
testing (Union[Unset, 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:
|
||||
PaginatedFrontendBasketList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
created_by_id=created_by_id,
|
||||
event=event,
|
||||
expand=expand,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
status=status,
|
||||
testing=testing,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
created_by_id: Union[Unset, int] = UNSET,
|
||||
event: Union[Unset, int] = UNSET,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
status: Union[Unset, str] = UNSET,
|
||||
testing: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedFrontendBasketList]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
created_by_id (Union[Unset, int]):
|
||||
event (Union[Unset, int]):
|
||||
expand (Union[Unset, str]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
status (Union[Unset, str]):
|
||||
testing (Union[Unset, 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[PaginatedFrontendBasketList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
created_by_id=created_by_id,
|
||||
event=event,
|
||||
expand=expand,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
status=status,
|
||||
testing=testing,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
created_by_id: Union[Unset, int] = UNSET,
|
||||
event: Union[Unset, int] = UNSET,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
o: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
page_limit: Union[Unset, int] = UNSET,
|
||||
q: Union[Unset, str] = UNSET,
|
||||
status: Union[Unset, str] = UNSET,
|
||||
testing: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedFrontendBasketList]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
created_by_id (Union[Unset, int]):
|
||||
event (Union[Unset, int]):
|
||||
expand (Union[Unset, str]):
|
||||
o (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
page_limit (Union[Unset, int]):
|
||||
q (Union[Unset, str]):
|
||||
status (Union[Unset, str]):
|
||||
testing (Union[Unset, 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:
|
||||
PaginatedFrontendBasketList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
created_by_id=created_by_id,
|
||||
event=event,
|
||||
expand=expand,
|
||||
o=o,
|
||||
offset=offset,
|
||||
page_limit=page_limit,
|
||||
q=q,
|
||||
status=status,
|
||||
testing=testing,
|
||||
)
|
||||
).parsed
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.frontend_basket import FrontendBasket
|
||||
from ...models.patched_frontend_basket import PatchedFrontendBasket
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
body: Union[
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "patch",
|
||||
"url": f"/api/v2/modules_basket/frontend_baskets/{id}/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
if isinstance(body, PatchedFrontendBasket):
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
if isinstance(body, PatchedFrontendBasket):
|
||||
_kwargs["data"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
if isinstance(body, PatchedFrontendBasket):
|
||||
_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[FrontendBasket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = FrontendBasket.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[FrontendBasket]:
|
||||
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[
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""Partial update (PATCH) definition
|
||||
Returns:
|
||||
response: the serialized data
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
|
||||
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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""Partial update (PATCH) definition
|
||||
Returns:
|
||||
response: the serialized data
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
|
||||
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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Union[
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""Partial update (PATCH) definition
|
||||
Returns:
|
||||
response: the serialized data
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
|
||||
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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
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[
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
PatchedFrontendBasket,
|
||||
],
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""Partial update (PATCH) definition
|
||||
Returns:
|
||||
response: the serialized data
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (Union[Unset, str]):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
body (PatchedFrontendBasket):
|
||||
|
||||
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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
expand=expand,
|
||||
)
|
||||
).parsed
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.frontend_basket import FrontendBasket
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["expand"] = expand
|
||||
|
||||
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/modules_basket/frontend_baskets/{id}/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[FrontendBasket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = FrontendBasket.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[FrontendBasket]:
|
||||
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,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
expand=expand,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Response[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (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[FrontendBasket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
expand=expand,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
expand: Union[Unset, str] = UNSET,
|
||||
) -> Optional[FrontendBasket]:
|
||||
"""ViewSet of model FrontendBasket, searching is possible via the following fields:
|
||||
pk, total, selectednode__pk, created_by__pk, created_by__email and created_by__username
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
expand (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:
|
||||
FrontendBasket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
expand=expand,
|
||||
)
|
||||
).parsed
|
||||
Reference in New Issue
Block a user