add openapi-python-client generator + client
This commit is contained in:
parent
6910cf37f2
commit
1cc7d01c27
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.13
|
||||||
6
main.py
Normal file
6
main.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
def main():
|
||||||
|
print("Hello from polyticket-api!")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
23
poly-ticket-api-client/.gitignore
vendored
Normal file
23
poly-ticket-api-client/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
__pycache__/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
|
.pytest_cache/
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# JetBrains
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
/coverage.xml
|
||||||
|
/.coverage
|
||||||
124
poly-ticket-api-client/README.md
Normal file
124
poly-ticket-api-client/README.md
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
# poly-ticket-api-client
|
||||||
|
A client library for accessing PolyTicket API
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
First, create a client:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from poly_ticket_api_client import Client
|
||||||
|
|
||||||
|
client = Client(base_url="https://api.example.com")
|
||||||
|
```
|
||||||
|
|
||||||
|
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from poly_ticket_api_client import AuthenticatedClient
|
||||||
|
|
||||||
|
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
||||||
|
```
|
||||||
|
|
||||||
|
Now call your endpoint and use your models:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from poly_ticket_api_client.models import MyDataModel
|
||||||
|
from poly_ticket_api_client.api.my_tag import get_my_data_model
|
||||||
|
from poly_ticket_api_client.types import Response
|
||||||
|
|
||||||
|
with client as client:
|
||||||
|
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
||||||
|
# or if you need more info (e.g. status_code)
|
||||||
|
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
||||||
|
```
|
||||||
|
|
||||||
|
Or do the same thing with an async version:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from poly_ticket_api_client.models import MyDataModel
|
||||||
|
from poly_ticket_api_client.api.my_tag import get_my_data_model
|
||||||
|
from poly_ticket_api_client.types import Response
|
||||||
|
|
||||||
|
async with client as client:
|
||||||
|
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
||||||
|
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
||||||
|
|
||||||
|
```python
|
||||||
|
client = AuthenticatedClient(
|
||||||
|
base_url="https://internal_api.example.com",
|
||||||
|
token="SuperSecretToken",
|
||||||
|
verify_ssl="/path/to/certificate_bundle.pem",
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
||||||
|
|
||||||
|
```python
|
||||||
|
client = AuthenticatedClient(
|
||||||
|
base_url="https://internal_api.example.com",
|
||||||
|
token="SuperSecretToken",
|
||||||
|
verify_ssl=False
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Things to know:
|
||||||
|
1. Every path/method combo becomes a Python module with four functions:
|
||||||
|
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
||||||
|
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
||||||
|
1. `asyncio`: Like `sync` but async instead of blocking
|
||||||
|
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
||||||
|
|
||||||
|
1. All path/query params, and bodies become method arguments.
|
||||||
|
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
||||||
|
1. Any endpoint which did not have a tag will be in `poly_ticket_api_client.api.default`
|
||||||
|
|
||||||
|
## Advanced customizations
|
||||||
|
|
||||||
|
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
||||||
|
|
||||||
|
```python
|
||||||
|
from poly_ticket_api_client import Client
|
||||||
|
|
||||||
|
def log_request(request):
|
||||||
|
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
||||||
|
|
||||||
|
def log_response(response):
|
||||||
|
request = response.request
|
||||||
|
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
||||||
|
|
||||||
|
client = Client(
|
||||||
|
base_url="https://api.example.com",
|
||||||
|
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
||||||
|
)
|
||||||
|
|
||||||
|
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
||||||
|
```
|
||||||
|
|
||||||
|
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
||||||
|
|
||||||
|
```python
|
||||||
|
import httpx
|
||||||
|
from poly_ticket_api_client import Client
|
||||||
|
|
||||||
|
client = Client(
|
||||||
|
base_url="https://api.example.com",
|
||||||
|
)
|
||||||
|
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
||||||
|
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building / publishing this package
|
||||||
|
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
||||||
|
1. Update the metadata in pyproject.toml (e.g. authors, version)
|
||||||
|
1. If you're using a private repository, configure it with Poetry
|
||||||
|
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
|
||||||
|
1. `poetry config http-basic.<your-repository-name> <username> <password>`
|
||||||
|
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
|
||||||
|
|
||||||
|
If you want to install this client into another project without publishing it (e.g. for development) then:
|
||||||
|
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
|
||||||
|
1. If that project is not using Poetry:
|
||||||
|
1. Build a wheel with `poetry build -f wheel`
|
||||||
|
1. Install that wheel from the other project `pip install <path-to-wheel>`
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
"""A client library for accessing PolyTicket API"""
|
||||||
|
|
||||||
|
from .client import AuthenticatedClient, Client
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"AuthenticatedClient",
|
||||||
|
"Client",
|
||||||
|
)
|
||||||
@ -0,0 +1 @@
|
|||||||
|
"""Contains methods for accessing the API"""
|
||||||
@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.refund import Refund
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
Refund,
|
||||||
|
Refund,
|
||||||
|
Refund,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": f"/api/v2/accounting/invoices/{id}/actions/refund/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, Refund):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, Refund):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, Refund):
|
||||||
|
_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[
|
||||||
|
Refund,
|
||||||
|
Refund,
|
||||||
|
Refund,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Proceed to a refund on an invoice, verifying the status and the validity of the amount.
|
||||||
|
Calls the method `refund_payment` on the payment module.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (Refund): Write only serializer used to provide `refund_amount` and `payment_intent`
|
||||||
|
to the action `refund` on `InvoiceViewSet`.
|
||||||
|
A model serializer is used to give access to the targeted invoice, even though the fields
|
||||||
|
are not part of the invoice model.
|
||||||
|
body (Refund): Write only serializer used to provide `refund_amount` and `payment_intent`
|
||||||
|
to the action `refund` on `InvoiceViewSet`.
|
||||||
|
A model serializer is used to give access to the targeted invoice, even though the fields
|
||||||
|
are not part of the invoice model.
|
||||||
|
body (Refund): Write only serializer used to provide `refund_amount` and `payment_intent`
|
||||||
|
to the action `refund` on `InvoiceViewSet`.
|
||||||
|
A model serializer is used to give access to the targeted invoice, even though the fields
|
||||||
|
are not part of the invoice 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[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[
|
||||||
|
Refund,
|
||||||
|
Refund,
|
||||||
|
Refund,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Proceed to a refund on an invoice, verifying the status and the validity of the amount.
|
||||||
|
Calls the method `refund_payment` on the payment module.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (Refund): Write only serializer used to provide `refund_amount` and `payment_intent`
|
||||||
|
to the action `refund` on `InvoiceViewSet`.
|
||||||
|
A model serializer is used to give access to the targeted invoice, even though the fields
|
||||||
|
are not part of the invoice model.
|
||||||
|
body (Refund): Write only serializer used to provide `refund_amount` and `payment_intent`
|
||||||
|
to the action `refund` on `InvoiceViewSet`.
|
||||||
|
A model serializer is used to give access to the targeted invoice, even though the fields
|
||||||
|
are not part of the invoice model.
|
||||||
|
body (Refund): Write only serializer used to provide `refund_amount` and `payment_intent`
|
||||||
|
to the action `refund` on `InvoiceViewSet`.
|
||||||
|
A model serializer is used to give access to the targeted invoice, even though the fields
|
||||||
|
are not part of the invoice 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[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,253 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.accounting_invoices_list_status import AccountingInvoicesListStatus
|
||||||
|
from ...models.paginated_invoice_list import PaginatedInvoiceList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
basket_id: Union[Unset, float] = UNSET,
|
||||||
|
event_id: Union[Unset, int] = 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, AccountingInvoicesListStatus] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["basket_id"] = basket_id
|
||||||
|
|
||||||
|
params["event_id"] = event_id
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
json_status: Union[Unset, str] = UNSET
|
||||||
|
if not isinstance(status, Unset):
|
||||||
|
json_status = status.value
|
||||||
|
|
||||||
|
params["status"] = json_status
|
||||||
|
|
||||||
|
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/accounting/invoices/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedInvoiceList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedInvoiceList.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[PaginatedInvoiceList]:
|
||||||
|
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, float] = UNSET,
|
||||||
|
event_id: Union[Unset, int] = 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, AccountingInvoicesListStatus] = UNSET,
|
||||||
|
) -> Response[PaginatedInvoiceList]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
Args:
|
||||||
|
basket_id (Union[Unset, float]):
|
||||||
|
event_id (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
status (Union[Unset, AccountingInvoicesListStatus]):
|
||||||
|
|
||||||
|
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[PaginatedInvoiceList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
basket_id=basket_id,
|
||||||
|
event_id=event_id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
status=status,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
basket_id: Union[Unset, float] = UNSET,
|
||||||
|
event_id: Union[Unset, int] = 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, AccountingInvoicesListStatus] = UNSET,
|
||||||
|
) -> Optional[PaginatedInvoiceList]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
Args:
|
||||||
|
basket_id (Union[Unset, float]):
|
||||||
|
event_id (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
status (Union[Unset, AccountingInvoicesListStatus]):
|
||||||
|
|
||||||
|
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:
|
||||||
|
PaginatedInvoiceList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
basket_id=basket_id,
|
||||||
|
event_id=event_id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
status=status,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
basket_id: Union[Unset, float] = UNSET,
|
||||||
|
event_id: Union[Unset, int] = 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, AccountingInvoicesListStatus] = UNSET,
|
||||||
|
) -> Response[PaginatedInvoiceList]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
Args:
|
||||||
|
basket_id (Union[Unset, float]):
|
||||||
|
event_id (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
status (Union[Unset, AccountingInvoicesListStatus]):
|
||||||
|
|
||||||
|
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[PaginatedInvoiceList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
basket_id=basket_id,
|
||||||
|
event_id=event_id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
status=status,
|
||||||
|
)
|
||||||
|
|
||||||
|
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, float] = UNSET,
|
||||||
|
event_id: Union[Unset, int] = 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, AccountingInvoicesListStatus] = UNSET,
|
||||||
|
) -> Optional[PaginatedInvoiceList]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
Args:
|
||||||
|
basket_id (Union[Unset, float]):
|
||||||
|
event_id (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
status (Union[Unset, AccountingInvoicesListStatus]):
|
||||||
|
|
||||||
|
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:
|
||||||
|
PaginatedInvoiceList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
basket_id=basket_id,
|
||||||
|
event_id=event_id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
status=status,
|
||||||
|
)
|
||||||
|
).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.invoice import Invoice
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/accounting/invoices/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Invoice]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Invoice.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[Invoice]:
|
||||||
|
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[Invoice]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
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[Invoice]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[Invoice]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
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:
|
||||||
|
Invoice
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Invoice]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
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[Invoice]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[Invoice]:
|
||||||
|
"""ViewSet for `Invoice` object
|
||||||
|
|
||||||
|
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:
|
||||||
|
Invoice
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@ -0,0 +1,211 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.uploaded_image import UploadedImage
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/common/uploaded_images/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UploadedImage):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UploadedImage):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UploadedImage):
|
||||||
|
_kwargs["files"] = body.to_multipart()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "multipart/form-data"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UploadedImage]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = UploadedImage.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_201
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UploadedImage]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
],
|
||||||
|
) -> Response[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[UploadedImage]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
],
|
||||||
|
) -> Optional[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
UploadedImage
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
],
|
||||||
|
) -> Response[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[UploadedImage]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
UploadedImage,
|
||||||
|
],
|
||||||
|
) -> Optional[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
body (UploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
UploadedImage
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,103 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "delete",
|
||||||
|
"url": f"/api/v2/common/uploaded_images/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
@ -0,0 +1,223 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_uploaded_image_list import PaginatedUploadedImageList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/common/uploaded_images/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedUploadedImageList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedUploadedImageList.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Response[PaginatedUploadedImageList]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedUploadedImageList]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedUploadedImageList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedUploadedImageList]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedUploadedImageList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedUploadedImageList]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedUploadedImageList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedUploadedImageList]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedUploadedImageList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,213 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.patched_uploaded_image import PatchedUploadedImage
|
||||||
|
from ...models.uploaded_image import UploadedImage
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/common/uploaded_images/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedUploadedImage):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedUploadedImage):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedUploadedImage):
|
||||||
|
_kwargs["files"] = body.to_multipart()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "multipart/form-data"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UploadedImage]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = UploadedImage.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UploadedImage]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
],
|
||||||
|
) -> Response[UploadedImage]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[UploadedImage]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
],
|
||||||
|
) -> Optional[UploadedImage]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
UploadedImage
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
],
|
||||||
|
) -> Response[UploadedImage]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[UploadedImage]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
PatchedUploadedImage,
|
||||||
|
],
|
||||||
|
) -> Optional[UploadedImage]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
body (PatchedUploadedImage):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
UploadedImage
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,166 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.uploaded_image import UploadedImage
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/common/uploaded_images/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UploadedImage]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = UploadedImage.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UploadedImage]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[UploadedImage]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Optional[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
UploadedImage
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[UploadedImage]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Optional[UploadedImage]:
|
||||||
|
"""Viewset for the UploadedImage model. Depending on the `privacy_level` of the object, the object will
|
||||||
|
be retrievable without authorization, with event authorization, or with ownership authorization.
|
||||||
|
|
||||||
|
This permission does not require IsJWTAuthenticated to be use in combination because we need to be
|
||||||
|
able to access public images without any authentication. The authentication for restricted image
|
||||||
|
access is performed with IsJWTAuthenticated in the permission itself.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
UploadedImage
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.api_token import ApiToken
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs() -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/core/api_tokens/actions/me/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[ApiToken]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ApiToken.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[ApiToken]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[ApiToken]:
|
||||||
|
"""
|
||||||
|
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[ApiToken]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs()
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Optional[ApiToken]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
ApiToken
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[ApiToken]:
|
||||||
|
"""
|
||||||
|
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[ApiToken]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs()
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Optional[ApiToken]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
ApiToken
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,199 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_api_token_list import PaginatedApiTokenList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/core/api_tokens/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedApiTokenList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedApiTokenList.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[PaginatedApiTokenList]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedApiTokenList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedApiTokenList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedApiTokenList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedApiTokenList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedApiTokenList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedApiTokenList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedApiTokenList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedApiTokenList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).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.api_token import ApiToken
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/core/api_tokens/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[ApiToken]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ApiToken.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[ApiToken]:
|
||||||
|
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[ApiToken]:
|
||||||
|
"""
|
||||||
|
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[ApiToken]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ApiToken]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
ApiToken
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[ApiToken]:
|
||||||
|
"""
|
||||||
|
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[ApiToken]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ApiToken]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
ApiToken
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,208 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.password_change_success import PasswordChangeSuccess
|
||||||
|
from ...models.user_password_change import UserPasswordChange
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/auth/actions/password_change/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UserPasswordChange):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UserPasswordChange):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UserPasswordChange):
|
||||||
|
_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[PasswordChangeSuccess]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PasswordChangeSuccess.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[PasswordChangeSuccess]:
|
||||||
|
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[
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
],
|
||||||
|
) -> Response[PasswordChangeSuccess]:
|
||||||
|
"""This ViewSet manages polyticket users password change.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
|
||||||
|
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[PasswordChangeSuccess]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
],
|
||||||
|
) -> Optional[PasswordChangeSuccess]:
|
||||||
|
"""This ViewSet manages polyticket users password change.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
|
||||||
|
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:
|
||||||
|
PasswordChangeSuccess
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
],
|
||||||
|
) -> Response[PasswordChangeSuccess]:
|
||||||
|
"""This ViewSet manages polyticket users password change.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
|
||||||
|
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[PasswordChangeSuccess]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
UserPasswordChange,
|
||||||
|
],
|
||||||
|
) -> Optional[PasswordChangeSuccess]:
|
||||||
|
"""This ViewSet manages polyticket users password change.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
body (UserPasswordChange): Serializer used for user password change requests. It verifies
|
||||||
|
the user has the correct current password for the account and validates the new one.
|
||||||
|
|
||||||
|
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:
|
||||||
|
PasswordChangeSuccess
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -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.password_reset_success import PasswordResetSuccess
|
||||||
|
from ...models.user_password_reset import UserPasswordReset
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/auth/actions/password_reset/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UserPasswordReset):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UserPasswordReset):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UserPasswordReset):
|
||||||
|
_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[PasswordResetSuccess]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PasswordResetSuccess.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[PasswordResetSuccess]:
|
||||||
|
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[
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
],
|
||||||
|
) -> Response[PasswordResetSuccess]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
|
||||||
|
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[PasswordResetSuccess]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
],
|
||||||
|
) -> Optional[PasswordResetSuccess]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
|
||||||
|
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:
|
||||||
|
PasswordResetSuccess
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
],
|
||||||
|
) -> Response[PasswordResetSuccess]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
|
||||||
|
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[PasswordResetSuccess]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
UserPasswordReset,
|
||||||
|
],
|
||||||
|
) -> Optional[PasswordResetSuccess]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
body (UserPasswordReset): Serializer used for user password reset. It should be used after
|
||||||
|
having made the request for a password reset.
|
||||||
|
|
||||||
|
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:
|
||||||
|
PasswordResetSuccess
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.user_password_reset_request import UserPasswordResetRequest
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/auth/actions/password_reset_request/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UserPasswordResetRequest):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UserPasswordResetRequest):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UserPasswordResetRequest):
|
||||||
|
_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(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Send an email with a password reset link, to be used in the
|
||||||
|
`UserPasswordResetViewSet.password_reset` action
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserPasswordResetRequest): Serializer used for users password reset requests. If
|
||||||
|
verifies the email is associated with a valid account.
|
||||||
|
body (UserPasswordResetRequest): Serializer used for users password reset requests. If
|
||||||
|
verifies the email is associated with a valid account.
|
||||||
|
body (UserPasswordResetRequest): Serializer used for users password reset requests. If
|
||||||
|
verifies the email is associated with a valid account.
|
||||||
|
|
||||||
|
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(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
UserPasswordResetRequest,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Send an email with a password reset link, to be used in the
|
||||||
|
`UserPasswordResetViewSet.password_reset` action
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserPasswordResetRequest): Serializer used for users password reset requests. If
|
||||||
|
verifies the email is associated with a valid account.
|
||||||
|
body (UserPasswordResetRequest): Serializer used for users password reset requests. If
|
||||||
|
verifies the email is associated with a valid account.
|
||||||
|
body (UserPasswordResetRequest): Serializer used for users password reset requests. If
|
||||||
|
verifies the email is associated with a valid account.
|
||||||
|
|
||||||
|
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(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
@ -0,0 +1,203 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.user_registration import UserRegistration
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/auth/actions/register/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UserRegistration):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UserRegistration):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UserRegistration):
|
||||||
|
_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[UserRegistration]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = UserRegistration.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[UserRegistration]:
|
||||||
|
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[
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
],
|
||||||
|
) -> Response[UserRegistration]:
|
||||||
|
"""Validate and create a new user with the given parameters and with an `is_active` attribute set to
|
||||||
|
False.
|
||||||
|
It then sends an activation email for this to be changed in a second step.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
|
||||||
|
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[UserRegistration]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
],
|
||||||
|
) -> Optional[UserRegistration]:
|
||||||
|
"""Validate and create a new user with the given parameters and with an `is_active` attribute set to
|
||||||
|
False.
|
||||||
|
It then sends an activation email for this to be changed in a second step.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
|
||||||
|
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:
|
||||||
|
UserRegistration
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
],
|
||||||
|
) -> Response[UserRegistration]:
|
||||||
|
"""Validate and create a new user with the given parameters and with an `is_active` attribute set to
|
||||||
|
False.
|
||||||
|
It then sends an activation email for this to be changed in a second step.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
|
||||||
|
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[UserRegistration]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
UserRegistration,
|
||||||
|
],
|
||||||
|
) -> Optional[UserRegistration]:
|
||||||
|
"""Validate and create a new user with the given parameters and with an `is_active` attribute set to
|
||||||
|
False.
|
||||||
|
It then sends an activation email for this to be changed in a second step.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
body (UserRegistration): Serializer for PolyTicketUser registration
|
||||||
|
|
||||||
|
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:
|
||||||
|
UserRegistration
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,201 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.user_verification import UserVerification
|
||||||
|
from ...models.verification_error import VerificationError
|
||||||
|
from ...models.verification_success import VerificationSuccess
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/auth/actions/register_verify/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UserVerification):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UserVerification):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UserVerification):
|
||||||
|
_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[Union[VerificationError, VerificationSuccess]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = VerificationSuccess.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = VerificationError.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
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[Union[VerificationError, VerificationSuccess]]:
|
||||||
|
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[
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
],
|
||||||
|
) -> Response[Union[VerificationError, VerificationSuccess]]:
|
||||||
|
"""This ViewSet manages polyticket users registration and email verification.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Union[VerificationError, VerificationSuccess]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
],
|
||||||
|
) -> Optional[Union[VerificationError, VerificationSuccess]]:
|
||||||
|
"""This ViewSet manages polyticket users registration and email verification.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[VerificationError, VerificationSuccess]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
],
|
||||||
|
) -> Response[Union[VerificationError, VerificationSuccess]]:
|
||||||
|
"""This ViewSet manages polyticket users registration and email verification.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Union[VerificationError, VerificationSuccess]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
UserVerification,
|
||||||
|
],
|
||||||
|
) -> Optional[Union[VerificationError, VerificationSuccess]]:
|
||||||
|
"""This ViewSet manages polyticket users registration and email verification.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
body (UserVerification): Serializer for PolyTicketUser verification
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[VerificationError, VerificationSuccess]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,196 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.login import Login
|
||||||
|
from ...models.login_result import LoginResult
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/auth/login/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, Login):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, Login):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, Login):
|
||||||
|
_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[LoginResult]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = LoginResult.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[LoginResult]:
|
||||||
|
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[
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
],
|
||||||
|
) -> Response[LoginResult]:
|
||||||
|
"""View that handles User authentication.
|
||||||
|
Returns an error for unsuccessful login or a JWT on successful login.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
|
||||||
|
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[LoginResult]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginResult]:
|
||||||
|
"""View that handles User authentication.
|
||||||
|
Returns an error for unsuccessful login or a JWT on successful login.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
|
||||||
|
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:
|
||||||
|
LoginResult
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
],
|
||||||
|
) -> Response[LoginResult]:
|
||||||
|
"""View that handles User authentication.
|
||||||
|
Returns an error for unsuccessful login or a JWT on successful login.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
|
||||||
|
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[LoginResult]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
Login,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginResult]:
|
||||||
|
"""View that handles User authentication.
|
||||||
|
Returns an error for unsuccessful login or a JWT on successful login.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
body (Login): Serializer used only for PolyTicketUser login.
|
||||||
|
|
||||||
|
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:
|
||||||
|
LoginResult
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).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.document import Document
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/documents/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, Document):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, Document):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, Document):
|
||||||
|
_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[Document]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = Document.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[Document]:
|
||||||
|
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[
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
],
|
||||||
|
) -> Response[Document]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` 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[Document]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
],
|
||||||
|
) -> Optional[Document]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` 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:
|
||||||
|
Document
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
],
|
||||||
|
) -> Response[Document]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` 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[Document]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
Document,
|
||||||
|
],
|
||||||
|
) -> Optional[Document]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` model
|
||||||
|
body (Document): Serializer for `Document` 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:
|
||||||
|
Document
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,199 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_document_list import PaginatedDocumentList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/core/documents/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedDocumentList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedDocumentList.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[PaginatedDocumentList]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedDocumentList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedDocumentList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedDocumentList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedDocumentList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedDocumentList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedDocumentList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedDocumentList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedDocumentList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).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.document import Document
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/core/documents/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Document]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Document.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[Document]:
|
||||||
|
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[Document]:
|
||||||
|
"""
|
||||||
|
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[Document]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[Document]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
Document
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Document]:
|
||||||
|
"""
|
||||||
|
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[Document]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[Document]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
Document
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.unit_member_ship_creation_by_email import UnitMemberShipCreationByEmail
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/unitmemberships/actions/create_by_email/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UnitMemberShipCreationByEmail):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UnitMemberShipCreationByEmail):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UnitMemberShipCreationByEmail):
|
||||||
|
_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(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Create a unitmembership using the email of the target user
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UnitMemberShipCreationByEmail): Serializer for the action create_by_email of
|
||||||
|
UnitMemberShipViewSet
|
||||||
|
body (UnitMemberShipCreationByEmail): Serializer for the action create_by_email of
|
||||||
|
UnitMemberShipViewSet
|
||||||
|
body (UnitMemberShipCreationByEmail): Serializer for the action create_by_email of
|
||||||
|
UnitMemberShipViewSet
|
||||||
|
|
||||||
|
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(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
UnitMemberShipCreationByEmail,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""Create a unitmembership using the email of the target user
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UnitMemberShipCreationByEmail): Serializer for the action create_by_email of
|
||||||
|
UnitMemberShipViewSet
|
||||||
|
body (UnitMemberShipCreationByEmail): Serializer for the action create_by_email of
|
||||||
|
UnitMemberShipViewSet
|
||||||
|
body (UnitMemberShipCreationByEmail): Serializer for the action create_by_email of
|
||||||
|
UnitMemberShipViewSet
|
||||||
|
|
||||||
|
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(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
@ -0,0 +1,195 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.unit_membership import UnitMembership
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/unitmemberships/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, UnitMembership):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, UnitMembership):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, UnitMembership):
|
||||||
|
_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[UnitMembership]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = UnitMembership.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[UnitMembership]:
|
||||||
|
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[
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
],
|
||||||
|
) -> Response[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership 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[UnitMembership]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
],
|
||||||
|
) -> Optional[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership 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:
|
||||||
|
UnitMembership
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
],
|
||||||
|
) -> Response[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership 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[UnitMembership]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
UnitMembership,
|
||||||
|
],
|
||||||
|
) -> Optional[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership model
|
||||||
|
body (UnitMembership): Serializer for UnitMembership 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:
|
||||||
|
UnitMembership
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
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/core/unitmemberships/{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]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
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]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
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,253 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.core_unitmemberships_list_role import CoreUnitmembershipsListRole
|
||||||
|
from ...models.paginated_unit_membership_list import PaginatedUnitMembershipList
|
||||||
|
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,
|
||||||
|
role: Union[Unset, CoreUnitmembershipsListRole] = UNSET,
|
||||||
|
unit: Union[Unset, int] = UNSET,
|
||||||
|
user: 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
|
||||||
|
|
||||||
|
json_role: Union[Unset, str] = UNSET
|
||||||
|
if not isinstance(role, Unset):
|
||||||
|
json_role = role.value
|
||||||
|
|
||||||
|
params["role"] = json_role
|
||||||
|
|
||||||
|
params["unit"] = unit
|
||||||
|
|
||||||
|
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/core/unitmemberships/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedUnitMembershipList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedUnitMembershipList.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[PaginatedUnitMembershipList]:
|
||||||
|
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,
|
||||||
|
role: Union[Unset, CoreUnitmembershipsListRole] = UNSET,
|
||||||
|
unit: Union[Unset, int] = UNSET,
|
||||||
|
user: Union[Unset, int] = UNSET,
|
||||||
|
) -> Response[PaginatedUnitMembershipList]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
role (Union[Unset, CoreUnitmembershipsListRole]):
|
||||||
|
unit (Union[Unset, int]):
|
||||||
|
user (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[PaginatedUnitMembershipList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
role=role,
|
||||||
|
unit=unit,
|
||||||
|
user=user,
|
||||||
|
)
|
||||||
|
|
||||||
|
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,
|
||||||
|
role: Union[Unset, CoreUnitmembershipsListRole] = UNSET,
|
||||||
|
unit: Union[Unset, int] = UNSET,
|
||||||
|
user: Union[Unset, int] = UNSET,
|
||||||
|
) -> Optional[PaginatedUnitMembershipList]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
role (Union[Unset, CoreUnitmembershipsListRole]):
|
||||||
|
unit (Union[Unset, int]):
|
||||||
|
user (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:
|
||||||
|
PaginatedUnitMembershipList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
role=role,
|
||||||
|
unit=unit,
|
||||||
|
user=user,
|
||||||
|
).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,
|
||||||
|
role: Union[Unset, CoreUnitmembershipsListRole] = UNSET,
|
||||||
|
unit: Union[Unset, int] = UNSET,
|
||||||
|
user: Union[Unset, int] = UNSET,
|
||||||
|
) -> Response[PaginatedUnitMembershipList]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
role (Union[Unset, CoreUnitmembershipsListRole]):
|
||||||
|
unit (Union[Unset, int]):
|
||||||
|
user (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[PaginatedUnitMembershipList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
role=role,
|
||||||
|
unit=unit,
|
||||||
|
user=user,
|
||||||
|
)
|
||||||
|
|
||||||
|
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,
|
||||||
|
role: Union[Unset, CoreUnitmembershipsListRole] = UNSET,
|
||||||
|
unit: Union[Unset, int] = UNSET,
|
||||||
|
user: Union[Unset, int] = UNSET,
|
||||||
|
) -> Optional[PaginatedUnitMembershipList]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
role (Union[Unset, CoreUnitmembershipsListRole]):
|
||||||
|
unit (Union[Unset, int]):
|
||||||
|
user (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:
|
||||||
|
PaginatedUnitMembershipList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
role=role,
|
||||||
|
unit=unit,
|
||||||
|
user=user,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,217 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.patched_unit_membership import PatchedUnitMembership
|
||||||
|
from ...models.unit_membership import UnitMembership
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/core/unitmemberships/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedUnitMembership):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedUnitMembership):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedUnitMembership):
|
||||||
|
_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[UnitMembership]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = UnitMembership.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[UnitMembership]:
|
||||||
|
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[
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
],
|
||||||
|
) -> Response[UnitMembership]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership 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[UnitMembership]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
],
|
||||||
|
) -> Optional[UnitMembership]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership 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:
|
||||||
|
UnitMembership
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
],
|
||||||
|
) -> Response[UnitMembership]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership 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[UnitMembership]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
PatchedUnitMembership,
|
||||||
|
],
|
||||||
|
) -> Optional[UnitMembership]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership model
|
||||||
|
body (PatchedUnitMembership): Serializer for UnitMembership 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:
|
||||||
|
UnitMembership
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.unit_membership import UnitMembership
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/core/unitmemberships/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[UnitMembership]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = UnitMembership.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[UnitMembership]:
|
||||||
|
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[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
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[UnitMembership]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
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:
|
||||||
|
UnitMembership
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
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[UnitMembership]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[UnitMembership]:
|
||||||
|
"""This ViewSet manages unit memberships.
|
||||||
|
|
||||||
|
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:
|
||||||
|
UnitMembership
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,195 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.unit import Unit
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/units/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, Unit):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, Unit):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, Unit):
|
||||||
|
_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[Unit]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = Unit.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[Unit]:
|
||||||
|
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[
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
],
|
||||||
|
) -> Response[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit 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[Unit]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
],
|
||||||
|
) -> Optional[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit 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:
|
||||||
|
Unit
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
],
|
||||||
|
) -> Response[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit 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[Unit]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
Unit,
|
||||||
|
],
|
||||||
|
) -> Optional[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit model
|
||||||
|
body (Unit): Serializer for Unit 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:
|
||||||
|
Unit
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,226 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_unit_list import PaginatedUnitList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
json_id: Union[Unset, list[int]] = UNSET
|
||||||
|
if not isinstance(id, Unset):
|
||||||
|
json_id = id
|
||||||
|
|
||||||
|
params["id"] = json_id
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/core/units/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedUnitList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedUnitList.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[PaginatedUnitList]:
|
||||||
|
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,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedUnitList]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedUnitList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedUnitList]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedUnitList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedUnitList]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedUnitList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedUnitList]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedUnitList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,213 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.patched_unit import PatchedUnit
|
||||||
|
from ...models.unit import Unit
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/core/units/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedUnit):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedUnit):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedUnit):
|
||||||
|
_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[Unit]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Unit.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[Unit]:
|
||||||
|
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[
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
],
|
||||||
|
) -> Response[Unit]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit 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[Unit]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
],
|
||||||
|
) -> Optional[Unit]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit 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:
|
||||||
|
Unit
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
],
|
||||||
|
) -> Response[Unit]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit 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[Unit]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
PatchedUnit,
|
||||||
|
],
|
||||||
|
) -> Optional[Unit]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit model
|
||||||
|
body (PatchedUnit): Serializer for Unit 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:
|
||||||
|
Unit
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.unit import Unit
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/core/units/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Unit]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Unit.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[Unit]:
|
||||||
|
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[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
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[Unit]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Unit
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
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[Unit]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[Unit]:
|
||||||
|
"""This ViewSet manages units.
|
||||||
|
Delete method is not allowed.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Unit
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,191 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.poly_ticket_user import PolyTicketUser
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/core/users/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PolyTicketUser):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PolyTicketUser):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PolyTicketUser):
|
||||||
|
_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[PolyTicketUser]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = PolyTicketUser.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[PolyTicketUser]:
|
||||||
|
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[
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Response[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
|
||||||
|
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[PolyTicketUser]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Optional[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
|
||||||
|
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:
|
||||||
|
PolyTicketUser
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Response[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
|
||||||
|
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[PolyTicketUser]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
PolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Optional[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
body (PolyTicketUser):
|
||||||
|
|
||||||
|
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:
|
||||||
|
PolyTicketUser
|
||||||
|
"""
|
||||||
|
|
||||||
|
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/core/users/{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,263 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_poly_ticket_user_list import PaginatedPolyTicketUserList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
email: Union[Unset, str] = UNSET,
|
||||||
|
first_name: Union[Unset, str] = UNSET,
|
||||||
|
last_name: 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,
|
||||||
|
units: Union[Unset, list[int]] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["email"] = email
|
||||||
|
|
||||||
|
params["first_name"] = first_name
|
||||||
|
|
||||||
|
params["last_name"] = last_name
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
json_units: Union[Unset, list[int]] = UNSET
|
||||||
|
if not isinstance(units, Unset):
|
||||||
|
json_units = units
|
||||||
|
|
||||||
|
params["units"] = json_units
|
||||||
|
|
||||||
|
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/core/users/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedPolyTicketUserList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedPolyTicketUserList.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[PaginatedPolyTicketUserList]:
|
||||||
|
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,
|
||||||
|
email: Union[Unset, str] = UNSET,
|
||||||
|
first_name: Union[Unset, str] = UNSET,
|
||||||
|
last_name: 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,
|
||||||
|
units: Union[Unset, list[int]] = UNSET,
|
||||||
|
) -> Response[PaginatedPolyTicketUserList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
email (Union[Unset, str]):
|
||||||
|
first_name (Union[Unset, str]):
|
||||||
|
last_name (Union[Unset, str]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
units (Union[Unset, list[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[PaginatedPolyTicketUserList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
email=email,
|
||||||
|
first_name=first_name,
|
||||||
|
last_name=last_name,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
units=units,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
email: Union[Unset, str] = UNSET,
|
||||||
|
first_name: Union[Unset, str] = UNSET,
|
||||||
|
last_name: 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,
|
||||||
|
units: Union[Unset, list[int]] = UNSET,
|
||||||
|
) -> Optional[PaginatedPolyTicketUserList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
email (Union[Unset, str]):
|
||||||
|
first_name (Union[Unset, str]):
|
||||||
|
last_name (Union[Unset, str]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
units (Union[Unset, list[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:
|
||||||
|
PaginatedPolyTicketUserList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
email=email,
|
||||||
|
first_name=first_name,
|
||||||
|
last_name=last_name,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
units=units,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
email: Union[Unset, str] = UNSET,
|
||||||
|
first_name: Union[Unset, str] = UNSET,
|
||||||
|
last_name: 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,
|
||||||
|
units: Union[Unset, list[int]] = UNSET,
|
||||||
|
) -> Response[PaginatedPolyTicketUserList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
email (Union[Unset, str]):
|
||||||
|
first_name (Union[Unset, str]):
|
||||||
|
last_name (Union[Unset, str]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
units (Union[Unset, list[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[PaginatedPolyTicketUserList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
email=email,
|
||||||
|
first_name=first_name,
|
||||||
|
last_name=last_name,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
units=units,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
email: Union[Unset, str] = UNSET,
|
||||||
|
first_name: Union[Unset, str] = UNSET,
|
||||||
|
last_name: 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,
|
||||||
|
units: Union[Unset, list[int]] = UNSET,
|
||||||
|
) -> Optional[PaginatedPolyTicketUserList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
email (Union[Unset, str]):
|
||||||
|
first_name (Union[Unset, str]):
|
||||||
|
last_name (Union[Unset, str]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
units (Union[Unset, list[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:
|
||||||
|
PaginatedPolyTicketUserList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
email=email,
|
||||||
|
first_name=first_name,
|
||||||
|
last_name=last_name,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
units=units,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,217 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.patched_poly_ticket_user import PatchedPolyTicketUser
|
||||||
|
from ...models.poly_ticket_user import PolyTicketUser
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/core/users/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedPolyTicketUser):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedPolyTicketUser):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedPolyTicketUser):
|
||||||
|
_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[PolyTicketUser]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PolyTicketUser.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[PolyTicketUser]:
|
||||||
|
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[
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Response[PolyTicketUser]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
|
||||||
|
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[PolyTicketUser]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Optional[PolyTicketUser]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
|
||||||
|
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:
|
||||||
|
PolyTicketUser
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Response[PolyTicketUser]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
|
||||||
|
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[PolyTicketUser]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
PatchedPolyTicketUser,
|
||||||
|
],
|
||||||
|
) -> Optional[PolyTicketUser]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
body (PatchedPolyTicketUser):
|
||||||
|
|
||||||
|
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:
|
||||||
|
PolyTicketUser
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).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.poly_ticket_user import PolyTicketUser
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/core/users/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PolyTicketUser]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PolyTicketUser.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[PolyTicketUser]:
|
||||||
|
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[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
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[PolyTicketUser]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
PolyTicketUser
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
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[PolyTicketUser]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[PolyTicketUser]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
PolyTicketUser
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -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
|
||||||
@ -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.create_anonymous_login import CreateAnonymousLogin
|
||||||
|
from ...models.login_jwt import LoginJWT
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_auth/anonymous_login/actions/create_login/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, CreateAnonymousLogin):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, CreateAnonymousLogin):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, CreateAnonymousLogin):
|
||||||
|
_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[LoginJWT]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = LoginJWT.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[LoginJWT]:
|
||||||
|
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[
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
],
|
||||||
|
) -> Response[LoginJWT]:
|
||||||
|
"""Create an anonymous frontend login. Accessible only on public events or in testing mode.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
|
||||||
|
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[LoginJWT]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginJWT]:
|
||||||
|
"""Create an anonymous frontend login. Accessible only on public events or in testing mode.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
|
||||||
|
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:
|
||||||
|
LoginJWT
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
],
|
||||||
|
) -> Response[LoginJWT]:
|
||||||
|
"""Create an anonymous frontend login. Accessible only on public events or in testing mode.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
|
||||||
|
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[LoginJWT]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
CreateAnonymousLogin,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginJWT]:
|
||||||
|
"""Create an anonymous frontend login. Accessible only on public events or in testing mode.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
body (CreateAnonymousLogin): Serializer used for AnonymousLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given.
|
||||||
|
|
||||||
|
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:
|
||||||
|
LoginJWT
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,207 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_anonymous_login_active_module import ModuleAuthAnonymousLoginActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_auth/anonymous_login/modules/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, ModuleAuthAnonymousLoginActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, ModuleAuthAnonymousLoginActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, ModuleAuthAnonymousLoginActiveModule):
|
||||||
|
_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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = ModuleAuthAnonymousLoginActiveModule.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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
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[
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthAnonymousLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
ModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
body (ModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthAnonymousLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
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/modules_auth/anonymous_login/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
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,220 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_module_auth_anonymous_login_active_module_list import (
|
||||||
|
PaginatedModuleAuthAnonymousLoginActiveModuleList,
|
||||||
|
)
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["event"] = event
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/modules_auth/anonymous_login/modules/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedModuleAuthAnonymousLoginActiveModuleList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedModuleAuthAnonymousLoginActiveModuleList.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[PaginatedModuleAuthAnonymousLoginActiveModuleList]:
|
||||||
|
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,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedModuleAuthAnonymousLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedModuleAuthAnonymousLoginActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedModuleAuthAnonymousLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedModuleAuthAnonymousLoginActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedModuleAuthAnonymousLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedModuleAuthAnonymousLoginActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedModuleAuthAnonymousLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedModuleAuthAnonymousLoginActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,229 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_anonymous_login_active_module import ModuleAuthAnonymousLoginActiveModule
|
||||||
|
from ...models.patched_module_auth_anonymous_login_active_module import PatchedModuleAuthAnonymousLoginActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/modules_auth/anonymous_login/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedModuleAuthAnonymousLoginActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedModuleAuthAnonymousLoginActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedModuleAuthAnonymousLoginActiveModule):
|
||||||
|
_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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ModuleAuthAnonymousLoginActiveModule.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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthAnonymousLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
PatchedModuleAuthAnonymousLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
body (PatchedModuleAuthAnonymousLoginActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleAuthAnonymousLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthAnonymousLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_anonymous_login_active_module import ModuleAuthAnonymousLoginActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/modules_auth/anonymous_login/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ModuleAuthAnonymousLoginActiveModule.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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthAnonymousLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ModuleAuthAnonymousLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthAnonymousLogin`.
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthAnonymousLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,248 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_frontend_login_list import PaginatedFrontendLoginList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: Union[Unset, bool] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["event"] = event
|
||||||
|
|
||||||
|
json_id: Union[Unset, list[int]] = UNSET
|
||||||
|
if not isinstance(id, Unset):
|
||||||
|
json_id = id
|
||||||
|
|
||||||
|
params["id"] = json_id
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
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_auth/frontend_logins/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedFrontendLoginList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedFrontendLoginList.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[PaginatedFrontendLoginList]:
|
||||||
|
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,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: Union[Unset, bool] = UNSET,
|
||||||
|
) -> Response[PaginatedFrontendLoginList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (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[PaginatedFrontendLoginList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: Union[Unset, bool] = UNSET,
|
||||||
|
) -> Optional[PaginatedFrontendLoginList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (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:
|
||||||
|
PaginatedFrontendLoginList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: Union[Unset, bool] = UNSET,
|
||||||
|
) -> Response[PaginatedFrontendLoginList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (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[PaginatedFrontendLoginList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
id: Union[Unset, list[int]] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: Union[Unset, bool] = UNSET,
|
||||||
|
) -> Optional[PaginatedFrontendLoginList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
id (Union[Unset, list[int]]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (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:
|
||||||
|
PaginatedFrontendLoginList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
id=id,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
)
|
||||||
|
).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.frontend_login import FrontendLogin
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/modules_auth/frontend_logins/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[FrontendLogin]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = FrontendLogin.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[FrontendLogin]:
|
||||||
|
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[FrontendLogin]:
|
||||||
|
"""
|
||||||
|
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[FrontendLogin]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[FrontendLogin]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
FrontendLogin
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[FrontendLogin]:
|
||||||
|
"""
|
||||||
|
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[FrontendLogin]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[FrontendLogin]:
|
||||||
|
"""
|
||||||
|
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:
|
||||||
|
FrontendLogin
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,229 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_login_method_list import PaginatedLoginMethodList
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
event: int,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: bool,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["event"] = event
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
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_auth/login_methods/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedLoginMethodList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedLoginMethodList.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[PaginatedLoginMethodList]:
|
||||||
|
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,
|
||||||
|
event: int,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: bool,
|
||||||
|
) -> Response[PaginatedLoginMethodList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (int):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, 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[PaginatedLoginMethodList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: int,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: bool,
|
||||||
|
) -> Optional[PaginatedLoginMethodList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (int):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, 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:
|
||||||
|
PaginatedLoginMethodList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: int,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: bool,
|
||||||
|
) -> Response[PaginatedLoginMethodList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (int):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, 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[PaginatedLoginMethodList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: int,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
testing: bool,
|
||||||
|
) -> Optional[PaginatedLoginMethodList]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
event (int):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, 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:
|
||||||
|
PaginatedLoginMethodList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
testing=testing,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,200 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.login_jwt import LoginJWT
|
||||||
|
from ...models.validate_third_party_token_login import ValidateThirdPartyTokenLogin
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_auth/third_party_token_login/actions/validate_login/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, ValidateThirdPartyTokenLogin):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, ValidateThirdPartyTokenLogin):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, ValidateThirdPartyTokenLogin):
|
||||||
|
_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[LoginJWT]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = LoginJWT.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[LoginJWT]:
|
||||||
|
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[
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
],
|
||||||
|
) -> Response[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[LoginJWT]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
LoginJWT
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
],
|
||||||
|
) -> Response[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[LoginJWT]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
ValidateThirdPartyTokenLogin,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
body (ValidateThirdPartyTokenLogin): Serializer used in the authentication of third party
|
||||||
|
logins with `third_party_token`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
LoginJWT
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,207 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_third_party_token_login_active_module import ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_auth/third_party_token_login/modules/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, ModuleAuthThirdPartyTokenLoginActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, ModuleAuthThirdPartyTokenLoginActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, ModuleAuthThirdPartyTokenLoginActiveModule):
|
||||||
|
_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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = ModuleAuthThirdPartyTokenLoginActiveModule.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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
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[
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (ModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
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/modules_auth/third_party_token_login/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
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,220 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_module_auth_third_party_token_login_active_module_list import (
|
||||||
|
PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList,
|
||||||
|
)
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["event"] = event
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/modules_auth/third_party_token_login/modules/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList.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[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]:
|
||||||
|
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,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedModuleAuthThirdPartyTokenLoginActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,231 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_third_party_token_login_active_module import ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
from ...models.patched_module_auth_third_party_token_login_active_module import (
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
)
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/modules_auth/third_party_token_login/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedModuleAuthThirdPartyTokenLoginActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedModuleAuthThirdPartyTokenLoginActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedModuleAuthThirdPartyTokenLoginActiveModule):
|
||||||
|
_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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ModuleAuthThirdPartyTokenLoginActiveModule.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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
PatchedModuleAuthThirdPartyTokenLoginActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
body (PatchedModuleAuthThirdPartyTokenLoginActiveModule): Serializer for `ActiveModule`
|
||||||
|
linked to `ModuleAuthThirdPartyTokenLogin`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_third_party_token_login_active_module import ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/modules_auth/third_party_token_login/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ModuleAuthThirdPartyTokenLoginActiveModule.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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ModuleAuthThirdPartyTokenLoginActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthThirdPartyTokenLogin`.
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthThirdPartyTokenLoginActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,131 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.create_trusted_email_login import CreateTrustedEmailLogin
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_auth/trusted_email/actions/create_login/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, CreateTrustedEmailLogin):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, CreateTrustedEmailLogin):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, CreateTrustedEmailLogin):
|
||||||
|
_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(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (CreateTrustedEmailLogin): Serializer used for TrustedEmailLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given and forces `email` to be provided.
|
||||||
|
body (CreateTrustedEmailLogin): Serializer used for TrustedEmailLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given and forces `email` to be provided.
|
||||||
|
body (CreateTrustedEmailLogin): Serializer used for TrustedEmailLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given and forces `email` to be provided.
|
||||||
|
|
||||||
|
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(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
CreateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (CreateTrustedEmailLogin): Serializer used for TrustedEmailLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given and forces `email` to be provided.
|
||||||
|
body (CreateTrustedEmailLogin): Serializer used for TrustedEmailLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given and forces `email` to be provided.
|
||||||
|
body (CreateTrustedEmailLogin): Serializer used for TrustedEmailLogin creation.
|
||||||
|
Adds `testing` (default to False) in data if not given and forces `email` to be provided.
|
||||||
|
|
||||||
|
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(
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
@ -0,0 +1,200 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.login_jwt import LoginJWT
|
||||||
|
from ...models.validate_trusted_email_login import ValidateTrustedEmailLogin
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_auth/trusted_email/actions/validate_login/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, ValidateTrustedEmailLogin):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, ValidateTrustedEmailLogin):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, ValidateTrustedEmailLogin):
|
||||||
|
_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[LoginJWT]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = LoginJWT.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[LoginJWT]:
|
||||||
|
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[
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> Response[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
|
||||||
|
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[LoginJWT]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
|
||||||
|
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:
|
||||||
|
LoginJWT
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> Response[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
|
||||||
|
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[LoginJWT]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
ValidateTrustedEmailLogin,
|
||||||
|
],
|
||||||
|
) -> Optional[LoginJWT]:
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
body (ValidateTrustedEmailLogin): Serializer used to retrieve credentials from the
|
||||||
|
TrustedEmailLogin activation url.
|
||||||
|
|
||||||
|
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:
|
||||||
|
LoginJWT
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,207 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_trusted_email_active_module import ModuleAuthTrustedEmailActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_auth/trusted_email/modules/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, ModuleAuthTrustedEmailActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, ModuleAuthTrustedEmailActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, ModuleAuthTrustedEmailActiveModule):
|
||||||
|
_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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = ModuleAuthTrustedEmailActiveModule.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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
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[
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthTrustedEmailActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
ModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (ModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthTrustedEmailActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
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/modules_auth/trusted_email/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
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,220 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_module_auth_trusted_email_active_module_list import (
|
||||||
|
PaginatedModuleAuthTrustedEmailActiveModuleList,
|
||||||
|
)
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["event"] = event
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/modules_auth/trusted_email/modules/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedModuleAuthTrustedEmailActiveModuleList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedModuleAuthTrustedEmailActiveModuleList.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[PaginatedModuleAuthTrustedEmailActiveModuleList]:
|
||||||
|
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,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedModuleAuthTrustedEmailActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedModuleAuthTrustedEmailActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedModuleAuthTrustedEmailActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedModuleAuthTrustedEmailActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedModuleAuthTrustedEmailActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedModuleAuthTrustedEmailActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedModuleAuthTrustedEmailActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedModuleAuthTrustedEmailActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,229 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_trusted_email_active_module import ModuleAuthTrustedEmailActiveModule
|
||||||
|
from ...models.patched_module_auth_trusted_email_active_module import PatchedModuleAuthTrustedEmailActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/modules_auth/trusted_email/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedModuleAuthTrustedEmailActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedModuleAuthTrustedEmailActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedModuleAuthTrustedEmailActiveModule):
|
||||||
|
_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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ModuleAuthTrustedEmailActiveModule.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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthTrustedEmailActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
PatchedModuleAuthTrustedEmailActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
body (PatchedModuleAuthTrustedEmailActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleAuthTrustedEmail`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthTrustedEmailActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.module_auth_trusted_email_active_module import ModuleAuthTrustedEmailActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": f"/api/v2/modules_auth/trusted_email/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ModuleAuthTrustedEmailActiveModule.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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthTrustedEmailActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[ModuleAuthTrustedEmailActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleAuthTrustedEmail`.
|
||||||
|
|
||||||
|
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:
|
||||||
|
ModuleAuthTrustedEmailActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -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
|
||||||
@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@ -0,0 +1,199 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.completion_started import CompletionStarted
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_completion/completion_started/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, CompletionStarted):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, CompletionStarted):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, CompletionStarted):
|
||||||
|
_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[CompletionStarted]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = CompletionStarted.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[CompletionStarted]:
|
||||||
|
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[
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
],
|
||||||
|
) -> Response[CompletionStarted]:
|
||||||
|
"""ViewSet to tell the backend that the customer has reached the ticket office summary page.
|
||||||
|
It will trigger hooks that, for example, send a payment reminder email.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
|
||||||
|
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[CompletionStarted]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
],
|
||||||
|
) -> Optional[CompletionStarted]:
|
||||||
|
"""ViewSet to tell the backend that the customer has reached the ticket office summary page.
|
||||||
|
It will trigger hooks that, for example, send a payment reminder email.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
|
||||||
|
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:
|
||||||
|
CompletionStarted
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
],
|
||||||
|
) -> Response[CompletionStarted]:
|
||||||
|
"""ViewSet to tell the backend that the customer has reached the ticket office summary page.
|
||||||
|
It will trigger hooks that, for example, send a payment reminder email.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
|
||||||
|
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[CompletionStarted]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
CompletionStarted,
|
||||||
|
],
|
||||||
|
) -> Optional[CompletionStarted]:
|
||||||
|
"""ViewSet to tell the backend that the customer has reached the ticket office summary page.
|
||||||
|
It will trigger hooks that, for example, send a payment reminder email.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
body (CompletionStarted): Serializer for CompletionStartedViewSet
|
||||||
|
|
||||||
|
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:
|
||||||
|
CompletionStarted
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,207 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.confirmation_page_extra_text_active_module import ConfirmationPageExtraTextActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/api/v2/modules_completion/confirmation_page_extra_text/modules/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, ConfirmationPageExtraTextActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, ConfirmationPageExtraTextActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, ConfirmationPageExtraTextActiveModule):
|
||||||
|
_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[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = ConfirmationPageExtraTextActiveModule.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[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
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[
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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[ConfirmationPageExtraTextActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ConfirmationPageExtraTextActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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[ConfirmationPageExtraTextActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
ConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (ConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked to
|
||||||
|
`ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ConfirmationPageExtraTextActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
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/modules_completion/confirmation_page_extra_text/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
id=id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
) -> Response[Any]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
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,220 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.paginated_confirmation_page_extra_text_active_module_list import (
|
||||||
|
PaginatedConfirmationPageExtraTextActiveModuleList,
|
||||||
|
)
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["event"] = event
|
||||||
|
|
||||||
|
params["o"] = o
|
||||||
|
|
||||||
|
params["offset"] = offset
|
||||||
|
|
||||||
|
params["page_limit"] = page_limit
|
||||||
|
|
||||||
|
params["q"] = q
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/api/v2/modules_completion/confirmation_page_extra_text/modules/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
|
) -> Optional[PaginatedConfirmationPageExtraTextActiveModuleList]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaginatedConfirmationPageExtraTextActiveModuleList.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[PaginatedConfirmationPageExtraTextActiveModuleList]:
|
||||||
|
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,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedConfirmationPageExtraTextActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedConfirmationPageExtraTextActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedConfirmationPageExtraTextActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedConfirmationPageExtraTextActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Response[PaginatedConfirmationPageExtraTextActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[PaginatedConfirmationPageExtraTextActiveModuleList]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
event: Union[Unset, int] = UNSET,
|
||||||
|
o: Union[Unset, str] = UNSET,
|
||||||
|
offset: Union[Unset, int] = UNSET,
|
||||||
|
page_limit: Union[Unset, int] = UNSET,
|
||||||
|
q: Union[Unset, str] = UNSET,
|
||||||
|
) -> Optional[PaginatedConfirmationPageExtraTextActiveModuleList]:
|
||||||
|
"""ViewSet of model `ActiveModule` linked to `ModuleCompletionConfirmationPageExtraText`.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
event (Union[Unset, int]):
|
||||||
|
o (Union[Unset, str]):
|
||||||
|
offset (Union[Unset, int]):
|
||||||
|
page_limit (Union[Unset, int]):
|
||||||
|
q (Union[Unset, str]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PaginatedConfirmationPageExtraTextActiveModuleList
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
event=event,
|
||||||
|
o=o,
|
||||||
|
offset=offset,
|
||||||
|
page_limit=page_limit,
|
||||||
|
q=q,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@ -0,0 +1,229 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.confirmation_page_extra_text_active_module import ConfirmationPageExtraTextActiveModule
|
||||||
|
from ...models.patched_confirmation_page_extra_text_active_module import PatchedConfirmationPageExtraTextActiveModule
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
body: Union[
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "patch",
|
||||||
|
"url": f"/api/v2/modules_completion/confirmation_page_extra_text/modules/{id}/",
|
||||||
|
}
|
||||||
|
|
||||||
|
if isinstance(body, PatchedConfirmationPageExtraTextActiveModule):
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
if isinstance(body, PatchedConfirmationPageExtraTextActiveModule):
|
||||||
|
_kwargs["data"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
if isinstance(body, PatchedConfirmationPageExtraTextActiveModule):
|
||||||
|
_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[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ConfirmationPageExtraTextActiveModule.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[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
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[
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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[ConfirmationPageExtraTextActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ConfirmationPageExtraTextActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
id: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Union[
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Response[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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[ConfirmationPageExtraTextActiveModule]
|
||||||
|
"""
|
||||||
|
|
||||||
|
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[
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
PatchedConfirmationPageExtraTextActiveModule,
|
||||||
|
],
|
||||||
|
) -> Optional[ConfirmationPageExtraTextActiveModule]:
|
||||||
|
"""Partial update (PATCH) definition
|
||||||
|
Returns:
|
||||||
|
response: the serialized data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (int):
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
body (PatchedConfirmationPageExtraTextActiveModule): Serializer for `ActiveModule` linked
|
||||||
|
to `ModuleCompletionConfirmationPageExtraText`
|
||||||
|
|
||||||
|
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:
|
||||||
|
ConfirmationPageExtraTextActiveModule
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
id=id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user