diff --git a/fishjam/_openapi_client/api/default/__init__.py b/fishjam/_openapi_client/api/default/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fishjam/_openapi_client/api/default/drain_node.py b/fishjam/_openapi_client/api/default/drain_node.py new file mode 100644 index 0000000..5b58a33 --- /dev/null +++ b/fishjam/_openapi_client/api/default/drain_node.py @@ -0,0 +1,127 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.error import Error +from ...types import Response + + +def _get_kwargs() -> Dict[str, Any]: + return { + "method": "post", + "url": "/admin/shutdown/drain", + } + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: + if response.status_code == HTTPStatus.OK: + response_200 = cast(Any, None) + return response_200 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = Error.from_dict(response.json()) + + return response_401 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Any, Error]]: + """Marks node as draining, making it the last in the load balancing order. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, Error]] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, +) -> Optional[Union[Any, Error]]: + """Marks node as draining, making it the last in the load balancing order. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, Error] + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Any, Error]]: + """Marks node as draining, making it the last in the load balancing order. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, Error]] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, +) -> Optional[Union[Any, Error]]: + """Marks node as draining, making it the last in the load balancing order. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, Error] + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/fishjam/_openapi_client/api/default/shutdown_status.py b/fishjam/_openapi_client/api/default/shutdown_status.py new file mode 100644 index 0000000..b68e607 --- /dev/null +++ b/fishjam/_openapi_client/api/default/shutdown_status.py @@ -0,0 +1,129 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.error import Error +from ...models.shutdown_status_response import ShutdownStatusResponse +from ...types import Response + + +def _get_kwargs() -> Dict[str, Any]: + return { + "method": "get", + "url": "/admin/shutdown/status", + } + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, ShutdownStatusResponse]]: + if response.status_code == HTTPStatus.OK: + response_200 = ShutdownStatusResponse.from_dict(response.json()) + + return response_200 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = Error.from_dict(response.json()) + + return response_401 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, ShutdownStatusResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Error, ShutdownStatusResponse]]: + """Returns status information for the shutdown process of Fishjam. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, ShutdownStatusResponse]] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, +) -> Optional[Union[Error, ShutdownStatusResponse]]: + """Returns status information for the shutdown process of Fishjam. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, ShutdownStatusResponse] + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Error, ShutdownStatusResponse]]: + """Returns status information for the shutdown process of Fishjam. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, ShutdownStatusResponse]] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, +) -> Optional[Union[Error, ShutdownStatusResponse]]: + """Returns status information for the shutdown process of Fishjam. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, ShutdownStatusResponse] + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/fishjam/_openapi_client/api/health/__init__.py b/fishjam/_openapi_client/api/health/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fishjam/_openapi_client/api/health/healthcheck.py b/fishjam/_openapi_client/api/health/healthcheck.py new file mode 100644 index 0000000..7d0a9ba --- /dev/null +++ b/fishjam/_openapi_client/api/health/healthcheck.py @@ -0,0 +1,129 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.error import Error +from ...models.healthcheck_response import HealthcheckResponse +from ...types import Response + + +def _get_kwargs() -> Dict[str, Any]: + return { + "method": "get", + "url": "/admin/health", + } + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, HealthcheckResponse]]: + if response.status_code == HTTPStatus.OK: + response_200 = HealthcheckResponse.from_dict(response.json()) + + return response_200 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = Error.from_dict(response.json()) + + return response_401 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, HealthcheckResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Error, HealthcheckResponse]]: + """Describes the health of Fishjam + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, HealthcheckResponse]] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, +) -> Optional[Union[Error, HealthcheckResponse]]: + """Describes the health of Fishjam + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, HealthcheckResponse] + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Error, HealthcheckResponse]]: + """Describes the health of Fishjam + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, HealthcheckResponse]] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, +) -> Optional[Union[Error, HealthcheckResponse]]: + """Describes the health of Fishjam + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, HealthcheckResponse] + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/fishjam/_openapi_client/api/user/__init__.py b/fishjam/_openapi_client/api/user/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fishjam/_openapi_client/api/user/delete_user.py b/fishjam/_openapi_client/api/user/delete_user.py new file mode 100644 index 0000000..09836cd --- /dev/null +++ b/fishjam/_openapi_client/api/user/delete_user.py @@ -0,0 +1,157 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.error import Error +from ...types import Response + + +def _get_kwargs( + id: str, +) -> Dict[str, Any]: + return { + "method": "delete", + "url": "/admin/user/{id}".format( + id=id, + ), + } + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: + if response.status_code == HTTPStatus.NO_CONTENT: + response_204 = cast(Any, None) + return response_204 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = Error.from_dict(response.json()) + + return response_401 + if response.status_code == HTTPStatus.SERVICE_UNAVAILABLE: + response_503 = Error.from_dict(response.json()) + + return response_503 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: + 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: str, + *, + client: AuthenticatedClient, +) -> Response[Union[Any, Error]]: + """Removes user with provided user id + + Args: + id (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[Union[Any, Error]] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[Union[Any, Error]]: + """Removes user with provided user id + + Args: + id (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: + Union[Any, Error] + """ + + return sync_detailed( + id=id, + client=client, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Union[Any, Error]]: + """Removes user with provided user id + + Args: + id (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[Union[Any, Error]] + """ + + 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: str, + *, + client: AuthenticatedClient, +) -> Optional[Union[Any, Error]]: + """Removes user with provided user id + + Args: + id (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: + Union[Any, Error] + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/fishjam/_openapi_client/api/user/get_all_users.py b/fishjam/_openapi_client/api/user/get_all_users.py new file mode 100644 index 0000000..3dbc290 --- /dev/null +++ b/fishjam/_openapi_client/api/user/get_all_users.py @@ -0,0 +1,133 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.error import Error +from ...models.user_listing_response import UserListingResponse +from ...types import Response + + +def _get_kwargs() -> Dict[str, Any]: + return { + "method": "get", + "url": "/admin/user", + } + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, UserListingResponse]]: + if response.status_code == HTTPStatus.OK: + response_200 = UserListingResponse.from_dict(response.json()) + + return response_200 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = Error.from_dict(response.json()) + + return response_401 + if response.status_code == HTTPStatus.SERVICE_UNAVAILABLE: + response_503 = Error.from_dict(response.json()) + + return response_503 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, UserListingResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Error, UserListingResponse]]: + """Show information about all users + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, UserListingResponse]] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, +) -> Optional[Union[Error, UserListingResponse]]: + """Show information about all users + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, UserListingResponse] + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[Union[Error, UserListingResponse]]: + """Show information about all users + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, UserListingResponse]] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, +) -> Optional[Union[Error, UserListingResponse]]: + """Show information about all users + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, UserListingResponse] + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/fishjam/_openapi_client/models/__init__.py b/fishjam/_openapi_client/models/__init__.py index 0ad7855..1e3e7c2 100644 --- a/fishjam/_openapi_client/models/__init__.py +++ b/fishjam/_openapi_client/models/__init__.py @@ -51,6 +51,7 @@ from .recording_list_response import RecordingListResponse from .room import Room from .room_config import RoomConfig +from .room_config_room_type import RoomConfigRoomType from .room_config_video_codec import RoomConfigVideoCodec from .room_create_details_response import RoomCreateDetailsResponse from .room_create_details_response_data import RoomCreateDetailsResponseData @@ -63,6 +64,8 @@ from .subscription_config import SubscriptionConfig from .track import Track from .track_type import TrackType +from .user import User +from .user_listing_response import UserListingResponse __all__ = ( "AddComponentJsonBody", @@ -108,6 +111,7 @@ "RecordingListResponse", "Room", "RoomConfig", + "RoomConfigRoomType", "RoomConfigVideoCodec", "RoomCreateDetailsResponse", "RoomCreateDetailsResponseData", @@ -120,4 +124,6 @@ "SubscriptionConfig", "Track", "TrackType", + "User", + "UserListingResponse", ) diff --git a/fishjam/_openapi_client/models/room_config.py b/fishjam/_openapi_client/models/room_config.py index 80bc616..2b98b41 100644 --- a/fishjam/_openapi_client/models/room_config.py +++ b/fishjam/_openapi_client/models/room_config.py @@ -3,6 +3,7 @@ from attrs import define as _attrs_define from attrs import field as _attrs_field +from ..models.room_config_room_type import RoomConfigRoomType from ..models.room_config_video_codec import RoomConfigVideoCodec from ..types import UNSET, Unset @@ -19,6 +20,8 @@ class RoomConfig: """Duration (in seconds) after which the peer will be removed if it is disconnected. If not provided, this feature is disabled.""" peerless_purge_timeout: Union[Unset, None, int] = UNSET """Duration (in seconds) after which the room will be removed if no peers are connected. If not provided, this feature is disabled.""" + room_type: Union[Unset, None, RoomConfigRoomType] = UNSET + """None""" video_codec: Union[Unset, None, RoomConfigVideoCodec] = UNSET """Enforces video codec for each peer in the room""" webhook_url: Union[Unset, None, str] = UNSET @@ -31,6 +34,10 @@ def to_dict(self) -> Dict[str, Any]: max_peers = self.max_peers peer_disconnected_timeout = self.peer_disconnected_timeout peerless_purge_timeout = self.peerless_purge_timeout + room_type: Union[Unset, None, str] = UNSET + if not isinstance(self.room_type, Unset): + room_type = self.room_type.value if self.room_type else None + video_codec: Union[Unset, None, str] = UNSET if not isinstance(self.video_codec, Unset): video_codec = self.video_codec.value if self.video_codec else None @@ -46,6 +53,8 @@ def to_dict(self) -> Dict[str, Any]: field_dict["peerDisconnectedTimeout"] = peer_disconnected_timeout if peerless_purge_timeout is not UNSET: field_dict["peerlessPurgeTimeout"] = peerless_purge_timeout + if room_type is not UNSET: + field_dict["roomType"] = room_type if video_codec is not UNSET: field_dict["videoCodec"] = video_codec if webhook_url is not UNSET: @@ -63,6 +72,15 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: peerless_purge_timeout = d.pop("peerlessPurgeTimeout", UNSET) + _room_type = d.pop("roomType", UNSET) + room_type: Union[Unset, None, RoomConfigRoomType] + if _room_type is None: + room_type = None + elif isinstance(_room_type, Unset): + room_type = UNSET + else: + room_type = RoomConfigRoomType(_room_type) + _video_codec = d.pop("videoCodec", UNSET) video_codec: Union[Unset, None, RoomConfigVideoCodec] if _video_codec is None: @@ -78,6 +96,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: max_peers=max_peers, peer_disconnected_timeout=peer_disconnected_timeout, peerless_purge_timeout=peerless_purge_timeout, + room_type=room_type, video_codec=video_codec, webhook_url=webhook_url, ) diff --git a/fishjam/_openapi_client/models/room_config_room_type.py b/fishjam/_openapi_client/models/room_config_room_type.py new file mode 100644 index 0000000..6e23a4d --- /dev/null +++ b/fishjam/_openapi_client/models/room_config_room_type.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class RoomConfigRoomType(str, Enum): + """None""" + + AUDIO_ONLY = "audio_only" + FULL_FEATURE = "full_feature" + + def __str__(self) -> str: + return str(self.value) diff --git a/fishjam/_openapi_client/models/user.py b/fishjam/_openapi_client/models/user.py new file mode 100644 index 0000000..1725167 --- /dev/null +++ b/fishjam/_openapi_client/models/user.py @@ -0,0 +1,67 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="User") + + +@_attrs_define +class User: + """Description of the user state""" + + token: str + """User token, has to be in UUID format""" + user_id: str + """User ID""" + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + """@private""" + + def to_dict(self) -> Dict[str, Any]: + """@private""" + token = self.token + user_id = self.user_id + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "token": token, + "user_id": user_id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + """@private""" + d = src_dict.copy() + token = d.pop("token") + + user_id = d.pop("user_id") + + user = cls( + token=token, + user_id=user_id, + ) + + user.additional_properties = d + return user + + @property + def additional_keys(self) -> List[str]: + """@private""" + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/fishjam/_openapi_client/models/user_listing_response.py b/fishjam/_openapi_client/models/user_listing_response.py new file mode 100644 index 0000000..1d1ee77 --- /dev/null +++ b/fishjam/_openapi_client/models/user_listing_response.py @@ -0,0 +1,75 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.user import User + + +T = TypeVar("T", bound="UserListingResponse") + + +@_attrs_define +class UserListingResponse: + """Response containing list of all users""" + + data: List["User"] + """None""" + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + """@private""" + + def to_dict(self) -> Dict[str, Any]: + """@private""" + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + + data.append(data_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + """@private""" + from ..models.user import User + + d = src_dict.copy() + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = User.from_dict(data_item_data) + + data.append(data_item) + + user_listing_response = cls( + data=data, + ) + + user_listing_response.additional_properties = d + return user_listing_response + + @property + def additional_keys(self) -> List[str]: + """@private""" + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/pyproject.toml b/pyproject.toml index aa3e761..151172d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fishjam-server-sdk" -version = "0.13.0" +version = "0.14.0" description = "Python server SDK for the Fishjam" authors = ["Fishjam Team"] homepage = "https://github.com/fishjam-cloud/python-server-sdk"