add openapi-python-client generator + client

This commit is contained in:
2025-07-11 12:00:23 +02:00
parent 6910cf37f2
commit 1cc7d01c27
485 changed files with 72495 additions and 0 deletions
@@ -0,0 +1 @@
"""Contains endpoint functions for accessing the API"""
@@ -0,0 +1,204 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.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