From ea7bf25e30648eb20ae142f6bd5cb23d9e28ffc0 Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:16:07 +0200 Subject: [PATCH 01/10] Release 0.26.0 --- fishjam/_openapi_client/api/room/add_peer.py | 59 +++++++++++-------- .../_openapi_client/api/room/create_room.py | 54 +++++++++-------- .../_openapi_client/api/room/delete_peer.py | 36 ++++++----- .../_openapi_client/api/room/delete_room.py | 34 ++++++----- .../_openapi_client/api/room/get_all_rooms.py | 28 +++++---- fishjam/_openapi_client/api/room/get_room.py | 34 ++++++----- .../_openapi_client/api/room/refresh_token.py | 36 ++++++----- .../api/room/subscribe_peer.py | 54 +++++++++-------- .../api/room/subscribe_tracks.py | 59 +++++++++++-------- .../api/stream/create_stream.py | 53 +++++++++-------- .../api/stream/delete_stream.py | 32 +++++----- .../api/stream/get_all_streams.py | 29 +++++---- .../_openapi_client/api/stream/get_stream.py | 33 ++++++----- .../api/streamer/create_streamer.py | 33 ++++++----- .../api/streamer/delete_streamer.py | 34 ++++++----- .../api/streamer/generate_streamer_token.py | 34 ++++++----- .../create_track_forwarding.py | 33 ++++++----- .../api/viewer/create_viewer.py | 33 ++++++----- .../api/viewer/delete_viewer.py | 34 ++++++----- .../api/viewer/generate_viewer_token.py | 34 ++++++----- fishjam/_openapi_client/client.py | 30 ++++------ .../_openapi_client/models/agent_output.py | 24 ++++---- .../models/composition_info.py | 12 ++-- fishjam/_openapi_client/models/error.py | 2 + fishjam/_openapi_client/models/peer.py | 28 ++++----- fishjam/_openapi_client/models/peer_config.py | 19 +++--- .../models/peer_details_response.py | 10 ++-- .../models/peer_details_response_data.py | 15 ++--- .../_openapi_client/models/peer_metadata.py | 2 + .../models/peer_options_agent.py | 25 ++++---- .../models/peer_options_vapi.py | 16 +++-- .../models/peer_options_web_rtc.py | 25 ++++---- .../models/peer_refresh_token_response.py | 10 ++-- .../peer_refresh_token_response_data.py | 2 + fishjam/_openapi_client/models/room.py | 30 ++++------ fishjam/_openapi_client/models/room_config.py | 49 ++++++++------- .../models/room_create_details_response.py | 10 ++-- .../room_create_details_response_data.py | 10 ++-- .../models/room_details_response.py | 10 ++-- .../models/rooms_listing_response.py | 12 ++-- fishjam/_openapi_client/models/stream.py | 21 +++---- .../_openapi_client/models/stream_config.py | 33 +++++------ .../models/stream_details_response.py | 10 ++-- fishjam/_openapi_client/models/streamer.py | 2 + .../models/streamer_details_response.py | 10 ++-- .../_openapi_client/models/streamer_token.py | 2 + .../models/streams_listing_response.py | 12 ++-- .../models/subscribe_tracks_body.py | 8 +-- .../_openapi_client/models/subscriptions.py | 8 +-- fishjam/_openapi_client/models/track.py | 34 +++++------ .../models/track_forwarding.py | 14 ++--- .../models/track_forwarding_info.py | 29 ++++----- .../_openapi_client/models/track_metadata.py | 2 + fishjam/_openapi_client/models/viewer.py | 2 + .../models/viewer_details_response.py | 10 ++-- .../_openapi_client/models/viewer_token.py | 2 + .../models/web_rtc_metadata.py | 2 + fishjam/_openapi_client/types.py | 18 +++--- pyproject.toml | 6 +- uv.lock | 11 ++-- 60 files changed, 701 insertions(+), 652 deletions(-) diff --git a/fishjam/_openapi_client/api/room/add_peer.py b/fishjam/_openapi_client/api/room/add_peer.py index b7c9507..84ec80c 100644 --- a/fishjam/_openapi_client/api/room/add_peer.py +++ b/fishjam/_openapi_client/api/room/add_peer.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -8,24 +9,25 @@ from ...models.error import Error from ...models.peer_config import PeerConfig from ...models.peer_details_response import PeerDetailsResponse -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( room_id: str, *, - body: PeerConfig, + body: PeerConfig | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { "method": "post", "url": "/room/{room_id}/peer".format( - room_id=room_id, + room_id=quote(str(room_id), safe=""), ), } - _kwargs["json"] = body.to_dict() + if not isinstance(body, Unset): + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -34,36 +36,43 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, PeerDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | PeerDetailsResponse | None: if response.status_code == 201: response_201 = PeerDetailsResponse.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 402: response_402 = Error.from_dict(response.json()) return response_402 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 409: response_409 = Error.from_dict(response.json()) return response_409 + if response.status_code == 503: 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: @@ -71,8 +80,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, PeerDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | PeerDetailsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -85,20 +94,20 @@ def sync_detailed( room_id: str, *, client: AuthenticatedClient, - body: PeerConfig, -) -> Response[Union[Error, PeerDetailsResponse]]: + body: PeerConfig | Unset = UNSET, +) -> Response[Error | PeerDetailsResponse]: """Create peer Args: room_id (str): - body (PeerConfig): Peer configuration + body (PeerConfig | Unset): Peer configuration Raises: errors.UnexpectedStatus: If the server returns 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, PeerDetailsResponse]] + Response[Error | PeerDetailsResponse] """ kwargs = _get_kwargs( @@ -117,20 +126,20 @@ def sync( room_id: str, *, client: AuthenticatedClient, - body: PeerConfig, -) -> Optional[Union[Error, PeerDetailsResponse]]: + body: PeerConfig | Unset = UNSET, +) -> Error | PeerDetailsResponse | None: """Create peer Args: room_id (str): - body (PeerConfig): Peer configuration + body (PeerConfig | Unset): Peer configuration Raises: errors.UnexpectedStatus: If the server 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, PeerDetailsResponse] + Error | PeerDetailsResponse """ return sync_detailed( @@ -144,20 +153,20 @@ async def asyncio_detailed( room_id: str, *, client: AuthenticatedClient, - body: PeerConfig, -) -> Response[Union[Error, PeerDetailsResponse]]: + body: PeerConfig | Unset = UNSET, +) -> Response[Error | PeerDetailsResponse]: """Create peer Args: room_id (str): - body (PeerConfig): Peer configuration + body (PeerConfig | Unset): Peer configuration Raises: errors.UnexpectedStatus: If the server returns 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, PeerDetailsResponse]] + Response[Error | PeerDetailsResponse] """ kwargs = _get_kwargs( @@ -174,20 +183,20 @@ async def asyncio( room_id: str, *, client: AuthenticatedClient, - body: PeerConfig, -) -> Optional[Union[Error, PeerDetailsResponse]]: + body: PeerConfig | Unset = UNSET, +) -> Error | PeerDetailsResponse | None: """Create peer Args: room_id (str): - body (PeerConfig): Peer configuration + body (PeerConfig | Unset): Peer configuration Raises: errors.UnexpectedStatus: If the server 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, PeerDetailsResponse] + Error | PeerDetailsResponse """ return ( diff --git a/fishjam/_openapi_client/api/room/create_room.py b/fishjam/_openapi_client/api/room/create_room.py index 9109c3f..9b438bd 100644 --- a/fishjam/_openapi_client/api/room/create_room.py +++ b/fishjam/_openapi_client/api/room/create_room.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -8,12 +8,12 @@ from ...models.error import Error from ...models.room_config import RoomConfig from ...models.room_create_details_response import RoomCreateDetailsResponse -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( *, - body: RoomConfig, + body: RoomConfig | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -22,7 +22,8 @@ def _get_kwargs( "url": "/room", } - _kwargs["json"] = body.to_dict() + if not isinstance(body, Unset): + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -31,28 +32,33 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, RoomCreateDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | RoomCreateDetailsResponse | None: if response.status_code == 201: response_201 = RoomCreateDetailsResponse.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 402: response_402 = Error.from_dict(response.json()) return response_402 + if response.status_code == 503: 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: @@ -60,8 +66,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, RoomCreateDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | RoomCreateDetailsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,19 +79,19 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - body: RoomConfig, -) -> Response[Union[Error, RoomCreateDetailsResponse]]: + body: RoomConfig | Unset = UNSET, +) -> Response[Error | RoomCreateDetailsResponse]: """Creates a room Args: - body (RoomConfig): Room configuration + body (RoomConfig | Unset): Room configuration Raises: errors.UnexpectedStatus: If the server returns 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, RoomCreateDetailsResponse]] + Response[Error | RoomCreateDetailsResponse] """ kwargs = _get_kwargs( @@ -102,19 +108,19 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - body: RoomConfig, -) -> Optional[Union[Error, RoomCreateDetailsResponse]]: + body: RoomConfig | Unset = UNSET, +) -> Error | RoomCreateDetailsResponse | None: """Creates a room Args: - body (RoomConfig): Room configuration + body (RoomConfig | Unset): Room configuration Raises: errors.UnexpectedStatus: If the server 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, RoomCreateDetailsResponse] + Error | RoomCreateDetailsResponse """ return sync_detailed( @@ -126,19 +132,19 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - body: RoomConfig, -) -> Response[Union[Error, RoomCreateDetailsResponse]]: + body: RoomConfig | Unset = UNSET, +) -> Response[Error | RoomCreateDetailsResponse]: """Creates a room Args: - body (RoomConfig): Room configuration + body (RoomConfig | Unset): Room configuration Raises: errors.UnexpectedStatus: If the server returns 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, RoomCreateDetailsResponse]] + Response[Error | RoomCreateDetailsResponse] """ kwargs = _get_kwargs( @@ -153,19 +159,19 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - body: RoomConfig, -) -> Optional[Union[Error, RoomCreateDetailsResponse]]: + body: RoomConfig | Unset = UNSET, +) -> Error | RoomCreateDetailsResponse | None: """Creates a room Args: - body (RoomConfig): Room configuration + body (RoomConfig | Unset): Room configuration Raises: errors.UnexpectedStatus: If the server 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, RoomCreateDetailsResponse] + Error | RoomCreateDetailsResponse """ return ( diff --git a/fishjam/_openapi_client/api/room/delete_peer.py b/fishjam/_openapi_client/api/room/delete_peer.py index bd72caa..f248f1e 100644 --- a/fishjam/_openapi_client/api/room/delete_peer.py +++ b/fishjam/_openapi_client/api/room/delete_peer.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -16,8 +17,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", "url": "/room/{room_id}/peer/{id}".format( - room_id=room_id, - id=id, + room_id=quote(str(room_id), safe=""), + id=quote(str(id), safe=""), ), } @@ -25,27 +26,32 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -53,8 +59,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +74,7 @@ def sync_detailed( id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete peer Args: @@ -80,7 +86,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -100,7 +106,7 @@ def sync( id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete peer Args: @@ -112,7 +118,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -127,7 +133,7 @@ async def asyncio_detailed( id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete peer Args: @@ -139,7 +145,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -157,7 +163,7 @@ async def asyncio( id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete peer Args: @@ -169,7 +175,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/room/delete_room.py b/fishjam/_openapi_client/api/room/delete_room.py index 6c26076..aca765e 100644 --- a/fishjam/_openapi_client/api/room/delete_room.py +++ b/fishjam/_openapi_client/api/room/delete_room.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -15,7 +16,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", "url": "/room/{room_id}".format( - room_id=room_id, + room_id=quote(str(room_id), safe=""), ), } @@ -23,27 +24,32 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -51,8 +57,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +71,7 @@ def sync_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete the room Args: @@ -76,7 +82,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -94,7 +100,7 @@ def sync( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete the room Args: @@ -105,7 +111,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -118,7 +124,7 @@ async def asyncio_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete the room Args: @@ -129,7 +135,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -145,7 +151,7 @@ async def asyncio( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete the room Args: @@ -156,7 +162,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/room/get_all_rooms.py b/fishjam/_openapi_client/api/room/get_all_rooms.py index 35e617b..c3927d7 100644 --- a/fishjam/_openapi_client/api/room/get_all_rooms.py +++ b/fishjam/_openapi_client/api/room/get_all_rooms.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -20,16 +20,18 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, RoomsListingResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | RoomsListingResponse | None: if response.status_code == 200: response_200 = RoomsListingResponse.from_dict(response.json()) return response_200 + if response.status_code == 401: 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: @@ -37,8 +39,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, RoomsListingResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | RoomsListingResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -50,7 +52,7 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, -) -> Response[Union[Error, RoomsListingResponse]]: +) -> Response[Error | RoomsListingResponse]: """Show information about all rooms Raises: @@ -58,7 +60,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, RoomsListingResponse]] + Response[Error | RoomsListingResponse] """ kwargs = _get_kwargs() @@ -73,7 +75,7 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, -) -> Optional[Union[Error, RoomsListingResponse]]: +) -> Error | RoomsListingResponse | None: """Show information about all rooms Raises: @@ -81,7 +83,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, RoomsListingResponse] + Error | RoomsListingResponse """ return sync_detailed( @@ -92,7 +94,7 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, -) -> Response[Union[Error, RoomsListingResponse]]: +) -> Response[Error | RoomsListingResponse]: """Show information about all rooms Raises: @@ -100,7 +102,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, RoomsListingResponse]] + Response[Error | RoomsListingResponse] """ kwargs = _get_kwargs() @@ -113,7 +115,7 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, -) -> Optional[Union[Error, RoomsListingResponse]]: +) -> Error | RoomsListingResponse | None: """Show information about all rooms Raises: @@ -121,7 +123,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, RoomsListingResponse] + Error | RoomsListingResponse """ return ( diff --git a/fishjam/_openapi_client/api/room/get_room.py b/fishjam/_openapi_client/api/room/get_room.py index 4063289..e5ba509 100644 --- a/fishjam/_openapi_client/api/room/get_room.py +++ b/fishjam/_openapi_client/api/room/get_room.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -16,7 +17,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", "url": "/room/{room_id}".format( - room_id=room_id, + room_id=quote(str(room_id), safe=""), ), } @@ -24,28 +25,33 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, RoomDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | RoomDetailsResponse | None: if response.status_code == 200: response_200 = RoomDetailsResponse.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -53,8 +59,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, RoomDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | RoomDetailsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +73,7 @@ def sync_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, RoomDetailsResponse]]: +) -> Response[Error | RoomDetailsResponse]: """Shows information about the room Args: @@ -78,7 +84,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, RoomDetailsResponse]] + Response[Error | RoomDetailsResponse] """ kwargs = _get_kwargs( @@ -96,7 +102,7 @@ def sync( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, RoomDetailsResponse]]: +) -> Error | RoomDetailsResponse | None: """Shows information about the room Args: @@ -107,7 +113,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, RoomDetailsResponse] + Error | RoomDetailsResponse """ return sync_detailed( @@ -120,7 +126,7 @@ async def asyncio_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, RoomDetailsResponse]]: +) -> Response[Error | RoomDetailsResponse]: """Shows information about the room Args: @@ -131,7 +137,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, RoomDetailsResponse]] + Response[Error | RoomDetailsResponse] """ kwargs = _get_kwargs( @@ -147,7 +153,7 @@ async def asyncio( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, RoomDetailsResponse]]: +) -> Error | RoomDetailsResponse | None: """Shows information about the room Args: @@ -158,7 +164,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, RoomDetailsResponse] + Error | RoomDetailsResponse """ return ( diff --git a/fishjam/_openapi_client/api/room/refresh_token.py b/fishjam/_openapi_client/api/room/refresh_token.py index 0e6f94e..fa2c28c 100644 --- a/fishjam/_openapi_client/api/room/refresh_token.py +++ b/fishjam/_openapi_client/api/room/refresh_token.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -17,8 +18,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", "url": "/room/{room_id}/peer/{id}/refresh_token".format( - room_id=room_id, - id=id, + room_id=quote(str(room_id), safe=""), + id=quote(str(id), safe=""), ), } @@ -26,28 +27,33 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, PeerRefreshTokenResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | PeerRefreshTokenResponse | None: if response.status_code == 201: response_201 = PeerRefreshTokenResponse.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -55,8 +61,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, PeerRefreshTokenResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | PeerRefreshTokenResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +76,7 @@ def sync_detailed( id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, PeerRefreshTokenResponse]]: +) -> Response[Error | PeerRefreshTokenResponse]: """Refresh peer token Args: @@ -82,7 +88,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, PeerRefreshTokenResponse]] + Response[Error | PeerRefreshTokenResponse] """ kwargs = _get_kwargs( @@ -102,7 +108,7 @@ def sync( id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, PeerRefreshTokenResponse]]: +) -> Error | PeerRefreshTokenResponse | None: """Refresh peer token Args: @@ -114,7 +120,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, PeerRefreshTokenResponse] + Error | PeerRefreshTokenResponse """ return sync_detailed( @@ -129,7 +135,7 @@ async def asyncio_detailed( id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, PeerRefreshTokenResponse]]: +) -> Response[Error | PeerRefreshTokenResponse]: """Refresh peer token Args: @@ -141,7 +147,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, PeerRefreshTokenResponse]] + Response[Error | PeerRefreshTokenResponse] """ kwargs = _get_kwargs( @@ -159,7 +165,7 @@ async def asyncio( id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, PeerRefreshTokenResponse]]: +) -> Error | PeerRefreshTokenResponse | None: """Refresh peer token Args: @@ -171,7 +177,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, PeerRefreshTokenResponse] + Error | PeerRefreshTokenResponse """ return ( diff --git a/fishjam/_openapi_client/api/room/subscribe_peer.py b/fishjam/_openapi_client/api/room/subscribe_peer.py index cfac6e8..6135f04 100644 --- a/fishjam/_openapi_client/api/room/subscribe_peer.py +++ b/fishjam/_openapi_client/api/room/subscribe_peer.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -13,7 +14,7 @@ def _get_kwargs( room_id: str, id: str, *, - peer_id: Union[Unset, str] = UNSET, + peer_id: str | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -24,8 +25,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", "url": "/room/{room_id}/peer/{id}/subscribe_peer".format( - room_id=room_id, - id=id, + room_id=quote(str(room_id), safe=""), + id=quote(str(id), safe=""), ), "params": params, } @@ -34,27 +35,32 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 200: response_200 = cast(Any, None) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -62,8 +68,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,21 +83,21 @@ def sync_detailed( id: str, *, client: AuthenticatedClient, - peer_id: Union[Unset, str] = UNSET, -) -> Response[Union[Any, Error]]: + peer_id: str | Unset = UNSET, +) -> Response[Any | Error]: """Subscribe peer to another peer's tracks Args: room_id (str): id (str): - peer_id (Union[Unset, str]): + peer_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns 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]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -112,21 +118,21 @@ def sync( id: str, *, client: AuthenticatedClient, - peer_id: Union[Unset, str] = UNSET, -) -> Optional[Union[Any, Error]]: + peer_id: str | Unset = UNSET, +) -> Any | Error | None: """Subscribe peer to another peer's tracks Args: room_id (str): id (str): - peer_id (Union[Unset, str]): + peer_id (str | Unset): Raises: errors.UnexpectedStatus: If the server 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] + Any | Error """ return sync_detailed( @@ -142,21 +148,21 @@ async def asyncio_detailed( id: str, *, client: AuthenticatedClient, - peer_id: Union[Unset, str] = UNSET, -) -> Response[Union[Any, Error]]: + peer_id: str | Unset = UNSET, +) -> Response[Any | Error]: """Subscribe peer to another peer's tracks Args: room_id (str): id (str): - peer_id (Union[Unset, str]): + peer_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns 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]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -175,21 +181,21 @@ async def asyncio( id: str, *, client: AuthenticatedClient, - peer_id: Union[Unset, str] = UNSET, -) -> Optional[Union[Any, Error]]: + peer_id: str | Unset = UNSET, +) -> Any | Error | None: """Subscribe peer to another peer's tracks Args: room_id (str): id (str): - peer_id (Union[Unset, str]): + peer_id (str | Unset): Raises: errors.UnexpectedStatus: If the server 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] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/room/subscribe_tracks.py b/fishjam/_openapi_client/api/room/subscribe_tracks.py index 413bb14..32f83c3 100644 --- a/fishjam/_openapi_client/api/room/subscribe_tracks.py +++ b/fishjam/_openapi_client/api/room/subscribe_tracks.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -7,26 +8,27 @@ from ...client import AuthenticatedClient, Client from ...models.error import Error from ...models.subscribe_tracks_body import SubscribeTracksBody -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( room_id: str, id: str, *, - body: SubscribeTracksBody, + body: SubscribeTracksBody | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { "method": "post", "url": "/room/{room_id}/peer/{id}/subscribe_tracks".format( - room_id=room_id, - id=id, + room_id=quote(str(room_id), safe=""), + id=quote(str(id), safe=""), ), } - _kwargs["json"] = body.to_dict() + if not isinstance(body, Unset): + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -35,27 +37,32 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 200: response_200 = cast(Any, None) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -63,8 +70,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -78,21 +85,21 @@ def sync_detailed( id: str, *, client: AuthenticatedClient, - body: SubscribeTracksBody, -) -> Response[Union[Any, Error]]: + body: SubscribeTracksBody | Unset = UNSET, +) -> Response[Any | Error]: """Subscribe peer to specific tracks Args: room_id (str): id (str): - body (SubscribeTracksBody): + body (SubscribeTracksBody | Unset): Raises: errors.UnexpectedStatus: If the server returns 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]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -113,21 +120,21 @@ def sync( id: str, *, client: AuthenticatedClient, - body: SubscribeTracksBody, -) -> Optional[Union[Any, Error]]: + body: SubscribeTracksBody | Unset = UNSET, +) -> Any | Error | None: """Subscribe peer to specific tracks Args: room_id (str): id (str): - body (SubscribeTracksBody): + body (SubscribeTracksBody | Unset): Raises: errors.UnexpectedStatus: If the server 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] + Any | Error """ return sync_detailed( @@ -143,21 +150,21 @@ async def asyncio_detailed( id: str, *, client: AuthenticatedClient, - body: SubscribeTracksBody, -) -> Response[Union[Any, Error]]: + body: SubscribeTracksBody | Unset = UNSET, +) -> Response[Any | Error]: """Subscribe peer to specific tracks Args: room_id (str): id (str): - body (SubscribeTracksBody): + body (SubscribeTracksBody | Unset): Raises: errors.UnexpectedStatus: If the server returns 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]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -176,21 +183,21 @@ async def asyncio( id: str, *, client: AuthenticatedClient, - body: SubscribeTracksBody, -) -> Optional[Union[Any, Error]]: + body: SubscribeTracksBody | Unset = UNSET, +) -> Any | Error | None: """Subscribe peer to specific tracks Args: room_id (str): id (str): - body (SubscribeTracksBody): + body (SubscribeTracksBody | Unset): Raises: errors.UnexpectedStatus: If the server 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] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/stream/create_stream.py b/fishjam/_openapi_client/api/stream/create_stream.py index 0626da7..e3a6991 100644 --- a/fishjam/_openapi_client/api/stream/create_stream.py +++ b/fishjam/_openapi_client/api/stream/create_stream.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -8,12 +8,12 @@ from ...models.error import Error from ...models.stream_config import StreamConfig from ...models.stream_details_response import StreamDetailsResponse -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( *, - body: StreamConfig, + body: StreamConfig | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -22,7 +22,8 @@ def _get_kwargs( "url": "/livestream", } - _kwargs["json"] = body.to_dict() + if not isinstance(body, Unset): + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -31,24 +32,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, StreamDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | StreamDetailsResponse | None: if response.status_code == 201: response_201 = StreamDetailsResponse.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 503: 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: @@ -56,8 +61,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, StreamDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | StreamDetailsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,19 +74,19 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - body: StreamConfig, -) -> Response[Union[Error, StreamDetailsResponse]]: + body: StreamConfig | Unset = UNSET, +) -> Response[Error | StreamDetailsResponse]: """Creates stream Args: - body (StreamConfig): Stream configuration + body (StreamConfig | Unset): Stream configuration Raises: errors.UnexpectedStatus: If the server returns 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, StreamDetailsResponse]] + Response[Error | StreamDetailsResponse] """ kwargs = _get_kwargs( @@ -98,19 +103,19 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - body: StreamConfig, -) -> Optional[Union[Error, StreamDetailsResponse]]: + body: StreamConfig | Unset = UNSET, +) -> Error | StreamDetailsResponse | None: """Creates stream Args: - body (StreamConfig): Stream configuration + body (StreamConfig | Unset): Stream configuration Raises: errors.UnexpectedStatus: If the server 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, StreamDetailsResponse] + Error | StreamDetailsResponse """ return sync_detailed( @@ -122,19 +127,19 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - body: StreamConfig, -) -> Response[Union[Error, StreamDetailsResponse]]: + body: StreamConfig | Unset = UNSET, +) -> Response[Error | StreamDetailsResponse]: """Creates stream Args: - body (StreamConfig): Stream configuration + body (StreamConfig | Unset): Stream configuration Raises: errors.UnexpectedStatus: If the server returns 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, StreamDetailsResponse]] + Response[Error | StreamDetailsResponse] """ kwargs = _get_kwargs( @@ -149,19 +154,19 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - body: StreamConfig, -) -> Optional[Union[Error, StreamDetailsResponse]]: + body: StreamConfig | Unset = UNSET, +) -> Error | StreamDetailsResponse | None: """Creates stream Args: - body (StreamConfig): Stream configuration + body (StreamConfig | Unset): Stream configuration Raises: errors.UnexpectedStatus: If the server 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, StreamDetailsResponse] + Error | StreamDetailsResponse """ return ( diff --git a/fishjam/_openapi_client/api/stream/delete_stream.py b/fishjam/_openapi_client/api/stream/delete_stream.py index af2ee1d..20aab6c 100644 --- a/fishjam/_openapi_client/api/stream/delete_stream.py +++ b/fishjam/_openapi_client/api/stream/delete_stream.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -15,7 +16,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", "url": "/livestream/{stream_id}".format( - stream_id=stream_id, + stream_id=quote(str(stream_id), safe=""), ), } @@ -23,19 +24,22 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 503: 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: @@ -43,8 +47,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -57,7 +61,7 @@ def sync_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Deletes stream Args: @@ -68,7 +72,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -86,7 +90,7 @@ def sync( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Deletes stream Args: @@ -97,7 +101,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -110,7 +114,7 @@ async def asyncio_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Deletes stream Args: @@ -121,7 +125,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -137,7 +141,7 @@ async def asyncio( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Deletes stream Args: @@ -148,7 +152,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/stream/get_all_streams.py b/fishjam/_openapi_client/api/stream/get_all_streams.py index db97398..85fd124 100644 --- a/fishjam/_openapi_client/api/stream/get_all_streams.py +++ b/fishjam/_openapi_client/api/stream/get_all_streams.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -20,20 +20,23 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, StreamsListingResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | StreamsListingResponse | None: if response.status_code == 200: response_200 = StreamsListingResponse.from_dict(response.json()) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 503: 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: @@ -41,8 +44,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, StreamsListingResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | StreamsListingResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -54,7 +57,7 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamsListingResponse]]: +) -> Response[Error | StreamsListingResponse]: """Show information about all streams Raises: @@ -62,7 +65,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamsListingResponse]] + Response[Error | StreamsListingResponse] """ kwargs = _get_kwargs() @@ -77,7 +80,7 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamsListingResponse]]: +) -> Error | StreamsListingResponse | None: """Show information about all streams Raises: @@ -85,7 +88,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamsListingResponse] + Error | StreamsListingResponse """ return sync_detailed( @@ -96,7 +99,7 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamsListingResponse]]: +) -> Response[Error | StreamsListingResponse]: """Show information about all streams Raises: @@ -104,7 +107,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamsListingResponse]] + Response[Error | StreamsListingResponse] """ kwargs = _get_kwargs() @@ -117,7 +120,7 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamsListingResponse]]: +) -> Error | StreamsListingResponse | None: """Show information about all streams Raises: @@ -125,7 +128,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamsListingResponse] + Error | StreamsListingResponse """ return ( diff --git a/fishjam/_openapi_client/api/stream/get_stream.py b/fishjam/_openapi_client/api/stream/get_stream.py index 296d9ce..1a3f3e2 100644 --- a/fishjam/_openapi_client/api/stream/get_stream.py +++ b/fishjam/_openapi_client/api/stream/get_stream.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -16,7 +17,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", "url": "/livestream/{stream_id}".format( - stream_id=stream_id, + stream_id=quote(str(stream_id), safe=""), ), } @@ -24,24 +25,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, StreamDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | StreamDetailsResponse | None: if response.status_code == 200: response_200 = StreamDetailsResponse.from_dict(response.json()) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -49,8 +54,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, StreamDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | StreamDetailsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +68,7 @@ def sync_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamDetailsResponse]]: +) -> Response[Error | StreamDetailsResponse]: """Shows information about the stream Args: @@ -74,7 +79,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamDetailsResponse]] + Response[Error | StreamDetailsResponse] """ kwargs = _get_kwargs( @@ -92,7 +97,7 @@ def sync( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamDetailsResponse]]: +) -> Error | StreamDetailsResponse | None: """Shows information about the stream Args: @@ -103,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamDetailsResponse] + Error | StreamDetailsResponse """ return sync_detailed( @@ -116,7 +121,7 @@ async def asyncio_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamDetailsResponse]]: +) -> Response[Error | StreamDetailsResponse]: """Shows information about the stream Args: @@ -127,7 +132,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamDetailsResponse]] + Response[Error | StreamDetailsResponse] """ kwargs = _get_kwargs( @@ -143,7 +148,7 @@ async def asyncio( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamDetailsResponse]]: +) -> Error | StreamDetailsResponse | None: """Shows information about the stream Args: @@ -154,7 +159,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamDetailsResponse] + Error | StreamDetailsResponse """ return ( diff --git a/fishjam/_openapi_client/api/streamer/create_streamer.py b/fishjam/_openapi_client/api/streamer/create_streamer.py index 4eff6b2..5dd4c87 100644 --- a/fishjam/_openapi_client/api/streamer/create_streamer.py +++ b/fishjam/_openapi_client/api/streamer/create_streamer.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -16,7 +17,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", "url": "/livestream/{stream_id}/streamer".format( - stream_id=stream_id, + stream_id=quote(str(stream_id), safe=""), ), } @@ -24,24 +25,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, StreamerDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | StreamerDetailsResponse | None: if response.status_code == 201: response_201 = StreamerDetailsResponse.from_dict(response.json()) return response_201 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -49,8 +54,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, StreamerDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | StreamerDetailsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +68,7 @@ def sync_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamerDetailsResponse]]: +) -> Response[Error | StreamerDetailsResponse]: """Creates streamer Args: @@ -74,7 +79,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamerDetailsResponse]] + Response[Error | StreamerDetailsResponse] """ kwargs = _get_kwargs( @@ -92,7 +97,7 @@ def sync( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamerDetailsResponse]]: +) -> Error | StreamerDetailsResponse | None: """Creates streamer Args: @@ -103,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamerDetailsResponse] + Error | StreamerDetailsResponse """ return sync_detailed( @@ -116,7 +121,7 @@ async def asyncio_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamerDetailsResponse]]: +) -> Response[Error | StreamerDetailsResponse]: """Creates streamer Args: @@ -127,7 +132,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamerDetailsResponse]] + Response[Error | StreamerDetailsResponse] """ kwargs = _get_kwargs( @@ -143,7 +148,7 @@ async def asyncio( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamerDetailsResponse]]: +) -> Error | StreamerDetailsResponse | None: """Creates streamer Args: @@ -154,7 +159,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamerDetailsResponse] + Error | StreamerDetailsResponse """ return ( diff --git a/fishjam/_openapi_client/api/streamer/delete_streamer.py b/fishjam/_openapi_client/api/streamer/delete_streamer.py index dd38830..fd2141b 100644 --- a/fishjam/_openapi_client/api/streamer/delete_streamer.py +++ b/fishjam/_openapi_client/api/streamer/delete_streamer.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -16,8 +17,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", "url": "/livestream/{stream_id}/streamer/{streamer_id}".format( - stream_id=stream_id, - streamer_id=streamer_id, + stream_id=quote(str(stream_id), safe=""), + streamer_id=quote(str(streamer_id), safe=""), ), } @@ -25,19 +26,22 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 503: 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: @@ -45,8 +49,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +64,7 @@ def sync_detailed( streamer_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Deletes streamer Args: @@ -72,7 +76,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -92,7 +96,7 @@ def sync( streamer_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Deletes streamer Args: @@ -104,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -119,7 +123,7 @@ async def asyncio_detailed( streamer_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Deletes streamer Args: @@ -131,7 +135,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -149,7 +153,7 @@ async def asyncio( streamer_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Deletes streamer Args: @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/streamer/generate_streamer_token.py b/fishjam/_openapi_client/api/streamer/generate_streamer_token.py index 53f12e0..f7f3ec8 100644 --- a/fishjam/_openapi_client/api/streamer/generate_streamer_token.py +++ b/fishjam/_openapi_client/api/streamer/generate_streamer_token.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -16,7 +17,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", "url": "/room/{room_id}/streamer".format( - room_id=room_id, + room_id=quote(str(room_id), safe=""), ), } @@ -24,28 +25,33 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, StreamerToken]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | StreamerToken | None: if response.status_code == 201: response_201 = StreamerToken.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -53,8 +59,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, StreamerToken]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | StreamerToken]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +73,7 @@ def sync_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamerToken]]: +) -> Response[Error | StreamerToken]: """Generate a token that can be used by a streamer to start streaming Args: @@ -78,7 +84,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamerToken]] + Response[Error | StreamerToken] """ kwargs = _get_kwargs( @@ -96,7 +102,7 @@ def sync( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamerToken]]: +) -> Error | StreamerToken | None: """Generate a token that can be used by a streamer to start streaming Args: @@ -107,7 +113,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamerToken] + Error | StreamerToken """ return sync_detailed( @@ -120,7 +126,7 @@ async def asyncio_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, StreamerToken]]: +) -> Response[Error | StreamerToken]: """Generate a token that can be used by a streamer to start streaming Args: @@ -131,7 +137,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, StreamerToken]] + Response[Error | StreamerToken] """ kwargs = _get_kwargs( @@ -147,7 +153,7 @@ async def asyncio( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, StreamerToken]]: +) -> Error | StreamerToken | None: """Generate a token that can be used by a streamer to start streaming Args: @@ -158,7 +164,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, StreamerToken] + Error | StreamerToken """ return ( diff --git a/fishjam/_openapi_client/api/track_forwarding/create_track_forwarding.py b/fishjam/_openapi_client/api/track_forwarding/create_track_forwarding.py index 1c7c303..d78180a 100644 --- a/fishjam/_openapi_client/api/track_forwarding/create_track_forwarding.py +++ b/fishjam/_openapi_client/api/track_forwarding/create_track_forwarding.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -20,7 +21,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", "url": "/room/{room_id}/track_forwardings".format( - room_id=room_id, + room_id=quote(str(room_id), safe=""), ), } @@ -33,23 +34,27 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 201: response_201 = cast(Any, None) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -57,8 +62,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +77,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TrackForwarding, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Creates a track forwarding in a room Args: @@ -84,7 +89,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -104,7 +109,7 @@ def sync( *, client: AuthenticatedClient, body: TrackForwarding, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Creates a track forwarding in a room Args: @@ -116,7 +121,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -131,7 +136,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TrackForwarding, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Creates a track forwarding in a room Args: @@ -143,7 +148,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -161,7 +166,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TrackForwarding, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Creates a track forwarding in a room Args: @@ -173,7 +178,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/viewer/create_viewer.py b/fishjam/_openapi_client/api/viewer/create_viewer.py index 8689054..d8b8c96 100644 --- a/fishjam/_openapi_client/api/viewer/create_viewer.py +++ b/fishjam/_openapi_client/api/viewer/create_viewer.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -16,7 +17,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", "url": "/livestream/{stream_id}/viewer".format( - stream_id=stream_id, + stream_id=quote(str(stream_id), safe=""), ), } @@ -24,24 +25,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, ViewerDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | ViewerDetailsResponse | None: if response.status_code == 201: response_201 = ViewerDetailsResponse.from_dict(response.json()) return response_201 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -49,8 +54,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, ViewerDetailsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | ViewerDetailsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +68,7 @@ def sync_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, ViewerDetailsResponse]]: +) -> Response[Error | ViewerDetailsResponse]: """Creates viewer Args: @@ -74,7 +79,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, ViewerDetailsResponse]] + Response[Error | ViewerDetailsResponse] """ kwargs = _get_kwargs( @@ -92,7 +97,7 @@ def sync( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, ViewerDetailsResponse]]: +) -> Error | ViewerDetailsResponse | None: """Creates viewer Args: @@ -103,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, ViewerDetailsResponse] + Error | ViewerDetailsResponse """ return sync_detailed( @@ -116,7 +121,7 @@ async def asyncio_detailed( stream_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, ViewerDetailsResponse]]: +) -> Response[Error | ViewerDetailsResponse]: """Creates viewer Args: @@ -127,7 +132,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, ViewerDetailsResponse]] + Response[Error | ViewerDetailsResponse] """ kwargs = _get_kwargs( @@ -143,7 +148,7 @@ async def asyncio( stream_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, ViewerDetailsResponse]]: +) -> Error | ViewerDetailsResponse | None: """Creates viewer Args: @@ -154,7 +159,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, ViewerDetailsResponse] + Error | ViewerDetailsResponse """ return ( diff --git a/fishjam/_openapi_client/api/viewer/delete_viewer.py b/fishjam/_openapi_client/api/viewer/delete_viewer.py index 82f577c..3db8e56 100644 --- a/fishjam/_openapi_client/api/viewer/delete_viewer.py +++ b/fishjam/_openapi_client/api/viewer/delete_viewer.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -16,8 +17,8 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", "url": "/livestream/{stream_id}/viewer/{viewer_id}".format( - stream_id=stream_id, - viewer_id=viewer_id, + stream_id=quote(str(stream_id), safe=""), + viewer_id=quote(str(viewer_id), safe=""), ), } @@ -25,19 +26,22 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 503: 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: @@ -45,8 +49,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +64,7 @@ def sync_detailed( viewer_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Deletes viewer Args: @@ -72,7 +76,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -92,7 +96,7 @@ def sync( viewer_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Deletes viewer Args: @@ -104,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -119,7 +123,7 @@ async def asyncio_detailed( viewer_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Deletes viewer Args: @@ -131,7 +135,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -149,7 +153,7 @@ async def asyncio( viewer_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Deletes viewer Args: @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/fishjam/_openapi_client/api/viewer/generate_viewer_token.py b/fishjam/_openapi_client/api/viewer/generate_viewer_token.py index 5e45f08..1f6a568 100644 --- a/fishjam/_openapi_client/api/viewer/generate_viewer_token.py +++ b/fishjam/_openapi_client/api/viewer/generate_viewer_token.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -16,7 +17,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", "url": "/room/{room_id}/viewer".format( - room_id=room_id, + room_id=quote(str(room_id), safe=""), ), } @@ -24,28 +25,33 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, ViewerToken]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | ViewerToken | None: if response.status_code == 201: response_201 = ViewerToken.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 503: 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: @@ -53,8 +59,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, ViewerToken]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | ViewerToken]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +73,7 @@ def sync_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, ViewerToken]]: +) -> Response[Error | ViewerToken]: """Generates token that a viewer can use to watch a livestream Args: @@ -78,7 +84,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, ViewerToken]] + Response[Error | ViewerToken] """ kwargs = _get_kwargs( @@ -96,7 +102,7 @@ def sync( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, ViewerToken]]: +) -> Error | ViewerToken | None: """Generates token that a viewer can use to watch a livestream Args: @@ -107,7 +113,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, ViewerToken] + Error | ViewerToken """ return sync_detailed( @@ -120,7 +126,7 @@ async def asyncio_detailed( room_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, ViewerToken]]: +) -> Response[Error | ViewerToken]: """Generates token that a viewer can use to watch a livestream Args: @@ -131,7 +137,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, ViewerToken]] + Response[Error | ViewerToken] """ kwargs = _get_kwargs( @@ -147,7 +153,7 @@ async def asyncio( room_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, ViewerToken]]: +) -> Error | ViewerToken | None: """Generates token that a viewer can use to watch a livestream Args: @@ -158,7 +164,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, ViewerToken] + Error | ViewerToken """ return ( diff --git a/fishjam/_openapi_client/client.py b/fishjam/_openapi_client/client.py index eeffd00..0ab1589 100644 --- a/fishjam/_openapi_client/client.py +++ b/fishjam/_openapi_client/client.py @@ -1,5 +1,5 @@ import ssl -from typing import Any, Optional, Union +from typing import Any import httpx from attrs import define, evolve, field @@ -38,18 +38,16 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field( - default=None, kw_only=True, alias="timeout" - ) - _verify_ssl: Union[str, bool, ssl.SSLContext] = field( + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field( default=True, kw_only=True, alias="verify_ssl" ) _follow_redirects: bool = field( default=False, kw_only=True, alias="follow_redirects" ) _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -68,7 +66,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -107,7 +105,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -174,18 +172,16 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field( - default=None, kw_only=True, alias="timeout" - ) - _verify_ssl: Union[str, bool, ssl.SSLContext] = field( + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field( default=True, kw_only=True, alias="verify_ssl" ) _follow_redirects: bool = field( default=False, kw_only=True, alias="follow_redirects" ) _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -208,7 +204,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -252,7 +248,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: def set_async_httpx_client( self, async_client: httpx.AsyncClient ) -> "AuthenticatedClient": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/fishjam/_openapi_client/models/agent_output.py b/fishjam/_openapi_client/models/agent_output.py index 6a3b85b..1149c10 100644 --- a/fishjam/_openapi_client/models/agent_output.py +++ b/fishjam/_openapi_client/models/agent_output.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - Union, -) +from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,19 +17,19 @@ class AgentOutput: """Output audio options Attributes: - audio_format (Union[Unset, AudioFormat]): The format of the output audio Example: pcm16. - audio_sample_rate (Union[Unset, AudioSampleRate]): The sample rate of the output audio Example: 16000. + audio_format (AudioFormat | Unset): The format of the output audio Example: pcm16. + audio_sample_rate (AudioSampleRate | Unset): The sample rate of the output audio Example: 16000. """ - audio_format: Union[Unset, AudioFormat] = UNSET - audio_sample_rate: Union[Unset, AudioSampleRate] = UNSET + audio_format: AudioFormat | Unset = UNSET + audio_sample_rate: AudioSampleRate | Unset = UNSET def to_dict(self) -> dict[str, Any]: - audio_format: Union[Unset, str] = UNSET + audio_format: str | Unset = UNSET if not isinstance(self.audio_format, Unset): audio_format = self.audio_format.value - audio_sample_rate: Union[Unset, int] = UNSET + audio_sample_rate: int | Unset = UNSET if not isinstance(self.audio_sample_rate, Unset): audio_sample_rate = self.audio_sample_rate.value @@ -49,14 +47,14 @@ def to_dict(self) -> dict[str, Any]: def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) _audio_format = d.pop("audioFormat", UNSET) - audio_format: Union[Unset, AudioFormat] + audio_format: AudioFormat | Unset if isinstance(_audio_format, Unset): audio_format = UNSET else: audio_format = AudioFormat(_audio_format) _audio_sample_rate = d.pop("audioSampleRate", UNSET) - audio_sample_rate: Union[Unset, AudioSampleRate] + audio_sample_rate: AudioSampleRate | Unset if isinstance(_audio_sample_rate, Unset): audio_sample_rate = UNSET else: diff --git a/fishjam/_openapi_client/models/composition_info.py b/fishjam/_openapi_client/models/composition_info.py index bb43317..db923aa 100644 --- a/fishjam/_openapi_client/models/composition_info.py +++ b/fishjam/_openapi_client/models/composition_info.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -21,11 +19,11 @@ class CompositionInfo: Attributes: composition_url (str): URL of the active composition Example: https://rtc.fishjam.io/api/composition/12asdfxcf. - forwardings (list['TrackForwardingInfo']): List of active track forwardings + forwardings (list[TrackForwardingInfo]): List of active track forwardings """ composition_url: str - forwardings: list["TrackForwardingInfo"] + forwardings: list[TrackForwardingInfo] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/error.py b/fishjam/_openapi_client/models/error.py index 0087ccf..7701760 100644 --- a/fishjam/_openapi_client/models/error.py +++ b/fishjam/_openapi_client/models/error.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/peer.py b/fishjam/_openapi_client/models/peer.py index 929e519..5f73d0b 100644 --- a/fishjam/_openapi_client/models/peer.py +++ b/fishjam/_openapi_client/models/peer.py @@ -1,11 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, - cast, -) +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -29,20 +25,20 @@ class Peer: Attributes: id (str): Assigned peer id Example: 4a1c1164-5fb7-425d-89d7-24cdb8fff1cf. - metadata (Union['PeerMetadata', None]): Custom metadata set by the peer Example: {'name': 'FishjamUser'}. + metadata (None | PeerMetadata): Custom metadata set by the peer Example: {'name': 'FishjamUser'}. status (PeerStatus): Informs about the peer status Example: disconnected. subscribe_mode (SubscribeMode): Configuration of peer's subscribing policy subscriptions (Subscriptions): Describes peer's subscriptions in manual mode - tracks (list['Track']): List of all peer's tracks + tracks (list[Track]): List of all peer's tracks type_ (PeerType): Peer type Example: webrtc. """ id: str - metadata: Union["PeerMetadata", None] + metadata: None | PeerMetadata status: PeerStatus subscribe_mode: SubscribeMode - subscriptions: "Subscriptions" - tracks: list["Track"] + subscriptions: Subscriptions + tracks: list[Track] type_: PeerType additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) @@ -51,7 +47,7 @@ def to_dict(self) -> dict[str, Any]: id = self.id - metadata: Union[None, dict[str, Any]] + metadata: dict[str, Any] | None if isinstance(self.metadata, PeerMetadata): metadata = self.metadata.to_dict() else: @@ -93,7 +89,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) id = d.pop("id") - def _parse_metadata(data: object) -> Union["PeerMetadata", None]: + def _parse_metadata(data: object) -> None | PeerMetadata: if data is None: return data try: @@ -102,9 +98,9 @@ def _parse_metadata(data: object) -> Union["PeerMetadata", None]: componentsschemas_peer_metadata_type_0 = PeerMetadata.from_dict(data) return componentsschemas_peer_metadata_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["PeerMetadata", None], data) + return cast(None | PeerMetadata, data) metadata = _parse_metadata(d.pop("metadata")) diff --git a/fishjam/_openapi_client/models/peer_config.py b/fishjam/_openapi_client/models/peer_config.py index 413b53c..eccbfea 100644 --- a/fishjam/_openapi_client/models/peer_config.py +++ b/fishjam/_openapi_client/models/peer_config.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -24,11 +21,11 @@ class PeerConfig: """Peer configuration Attributes: - options (Union['PeerOptionsAgent', 'PeerOptionsVapi', 'PeerOptionsWebRTC']): Peer-specific options + options (PeerOptionsAgent | PeerOptionsVapi | PeerOptionsWebRTC): Peer-specific options type_ (PeerType): Peer type Example: webrtc. """ - options: Union["PeerOptionsAgent", "PeerOptionsVapi", "PeerOptionsWebRTC"] + options: PeerOptionsAgent | PeerOptionsVapi | PeerOptionsWebRTC type_: PeerType def to_dict(self) -> dict[str, Any]: @@ -64,7 +61,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def _parse_options( data: object, - ) -> Union["PeerOptionsAgent", "PeerOptionsVapi", "PeerOptionsWebRTC"]: + ) -> PeerOptionsAgent | PeerOptionsVapi | PeerOptionsWebRTC: try: if not isinstance(data, dict): raise TypeError() @@ -73,7 +70,7 @@ def _parse_options( ) return componentsschemas_peer_options_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -81,7 +78,7 @@ def _parse_options( componentsschemas_peer_options_type_1 = PeerOptionsAgent.from_dict(data) return componentsschemas_peer_options_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, dict): raise TypeError() diff --git a/fishjam/_openapi_client/models/peer_details_response.py b/fishjam/_openapi_client/models/peer_details_response.py index 718c26c..98f2071 100644 --- a/fishjam/_openapi_client/models/peer_details_response.py +++ b/fishjam/_openapi_client/models/peer_details_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,7 +21,7 @@ class PeerDetailsResponse: data (PeerDetailsResponseData): """ - data: "PeerDetailsResponseData" + data: PeerDetailsResponseData additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/peer_details_response_data.py b/fishjam/_openapi_client/models/peer_details_response_data.py index fbf3fb3..4190e1b 100644 --- a/fishjam/_openapi_client/models/peer_details_response_data.py +++ b/fishjam/_openapi_client/models/peer_details_response_data.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -24,13 +21,13 @@ class PeerDetailsResponseData: Attributes: peer (Peer): Describes peer status token (str): Token for authorizing websocket connection Example: 5cdac726-57a3-4ecb-b1d5-72a3d62ec242. - peer_websocket_url (Union[Unset, str]): Websocket URL to which peer has to connect Example: + peer_websocket_url (str | Unset): Websocket URL to which peer has to connect Example: www.fishjam.org/socket/peer. """ - peer: "Peer" + peer: Peer token: str - peer_websocket_url: Union[Unset, str] = UNSET + peer_websocket_url: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/peer_metadata.py b/fishjam/_openapi_client/models/peer_metadata.py index e78c90d..27c4888 100644 --- a/fishjam/_openapi_client/models/peer_metadata.py +++ b/fishjam/_openapi_client/models/peer_metadata.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/peer_options_agent.py b/fishjam/_openapi_client/models/peer_options_agent.py index 03df548..84acd85 100644 --- a/fishjam/_openapi_client/models/peer_options_agent.py +++ b/fishjam/_openapi_client/models/peer_options_agent.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -23,19 +20,19 @@ class PeerOptionsAgent: """Options specific to the Agent peer Attributes: - output (Union[Unset, AgentOutput]): Output audio options - subscribe_mode (Union[Unset, SubscribeMode]): Configuration of peer's subscribing policy + output (AgentOutput | Unset): Output audio options + subscribe_mode (SubscribeMode | Unset): Configuration of peer's subscribing policy """ - output: Union[Unset, "AgentOutput"] = UNSET - subscribe_mode: Union[Unset, SubscribeMode] = UNSET + output: AgentOutput | Unset = UNSET + subscribe_mode: SubscribeMode | Unset = UNSET def to_dict(self) -> dict[str, Any]: - output: Union[Unset, dict[str, Any]] = UNSET + output: dict[str, Any] | Unset = UNSET if not isinstance(self.output, Unset): output = self.output.to_dict() - subscribe_mode: Union[Unset, str] = UNSET + subscribe_mode: str | Unset = UNSET if not isinstance(self.subscribe_mode, Unset): subscribe_mode = self.subscribe_mode.value @@ -55,14 +52,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) _output = d.pop("output", UNSET) - output: Union[Unset, AgentOutput] + output: AgentOutput | Unset if isinstance(_output, Unset): output = UNSET else: output = AgentOutput.from_dict(_output) _subscribe_mode = d.pop("subscribeMode", UNSET) - subscribe_mode: Union[Unset, SubscribeMode] + subscribe_mode: SubscribeMode | Unset if isinstance(_subscribe_mode, Unset): subscribe_mode = UNSET else: diff --git a/fishjam/_openapi_client/models/peer_options_vapi.py b/fishjam/_openapi_client/models/peer_options_vapi.py index 078e473..3e41618 100644 --- a/fishjam/_openapi_client/models/peer_options_vapi.py +++ b/fishjam/_openapi_client/models/peer_options_vapi.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - Union, -) +from typing import Any, TypeVar from attrs import define as _attrs_define @@ -20,19 +18,19 @@ class PeerOptionsVapi: Attributes: api_key (str): VAPI API key call_id (str): VAPI call ID - subscribe_mode (Union[Unset, SubscribeMode]): Configuration of peer's subscribing policy + subscribe_mode (SubscribeMode | Unset): Configuration of peer's subscribing policy """ api_key: str call_id: str - subscribe_mode: Union[Unset, SubscribeMode] = UNSET + subscribe_mode: SubscribeMode | Unset = UNSET def to_dict(self) -> dict[str, Any]: api_key = self.api_key call_id = self.call_id - subscribe_mode: Union[Unset, str] = UNSET + subscribe_mode: str | Unset = UNSET if not isinstance(self.subscribe_mode, Unset): subscribe_mode = self.subscribe_mode.value @@ -55,7 +53,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: call_id = d.pop("callId") _subscribe_mode = d.pop("subscribeMode", UNSET) - subscribe_mode: Union[Unset, SubscribeMode] + subscribe_mode: SubscribeMode | Unset if isinstance(_subscribe_mode, Unset): subscribe_mode = UNSET else: diff --git a/fishjam/_openapi_client/models/peer_options_web_rtc.py b/fishjam/_openapi_client/models/peer_options_web_rtc.py index 326cab1..ba7f92b 100644 --- a/fishjam/_openapi_client/models/peer_options_web_rtc.py +++ b/fishjam/_openapi_client/models/peer_options_web_rtc.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -23,19 +20,19 @@ class PeerOptionsWebRTC: """Options specific to the WebRTC peer Attributes: - metadata (Union[Unset, WebRTCMetadata]): Custom peer metadata - subscribe_mode (Union[Unset, SubscribeMode]): Configuration of peer's subscribing policy + metadata (WebRTCMetadata | Unset): Custom peer metadata + subscribe_mode (SubscribeMode | Unset): Configuration of peer's subscribing policy """ - metadata: Union[Unset, "WebRTCMetadata"] = UNSET - subscribe_mode: Union[Unset, SubscribeMode] = UNSET + metadata: WebRTCMetadata | Unset = UNSET + subscribe_mode: SubscribeMode | Unset = UNSET def to_dict(self) -> dict[str, Any]: - metadata: Union[Unset, dict[str, Any]] = UNSET + metadata: dict[str, Any] | Unset = UNSET if not isinstance(self.metadata, Unset): metadata = self.metadata.to_dict() - subscribe_mode: Union[Unset, str] = UNSET + subscribe_mode: str | Unset = UNSET if not isinstance(self.subscribe_mode, Unset): subscribe_mode = self.subscribe_mode.value @@ -55,14 +52,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) _metadata = d.pop("metadata", UNSET) - metadata: Union[Unset, WebRTCMetadata] + metadata: WebRTCMetadata | Unset if isinstance(_metadata, Unset): metadata = UNSET else: metadata = WebRTCMetadata.from_dict(_metadata) _subscribe_mode = d.pop("subscribeMode", UNSET) - subscribe_mode: Union[Unset, SubscribeMode] + subscribe_mode: SubscribeMode | Unset if isinstance(_subscribe_mode, Unset): subscribe_mode = UNSET else: diff --git a/fishjam/_openapi_client/models/peer_refresh_token_response.py b/fishjam/_openapi_client/models/peer_refresh_token_response.py index 6075525..c64cd35 100644 --- a/fishjam/_openapi_client/models/peer_refresh_token_response.py +++ b/fishjam/_openapi_client/models/peer_refresh_token_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,7 +21,7 @@ class PeerRefreshTokenResponse: data (PeerRefreshTokenResponseData): """ - data: "PeerRefreshTokenResponseData" + data: PeerRefreshTokenResponseData additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/peer_refresh_token_response_data.py b/fishjam/_openapi_client/models/peer_refresh_token_response_data.py index ca1aebc..e38a1fe 100644 --- a/fishjam/_openapi_client/models/peer_refresh_token_response_data.py +++ b/fishjam/_openapi_client/models/peer_refresh_token_response_data.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/room.py b/fishjam/_openapi_client/models/room.py index 79259ab..05fec29 100644 --- a/fishjam/_openapi_client/models/room.py +++ b/fishjam/_openapi_client/models/room.py @@ -1,11 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, - cast, -) +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -28,14 +24,14 @@ class Room: Attributes: config (RoomConfig): Room configuration id (str): Room ID Example: room-1. - peers (list['Peer']): List of all peers - composition_info (Union['CompositionInfo', None, Unset]): Composition and track forwarding state for the room + peers (list[Peer]): List of all peers + composition_info (CompositionInfo | None | Unset): Composition and track forwarding state for the room """ - config: "RoomConfig" + config: RoomConfig id: str - peers: list["Peer"] - composition_info: Union["CompositionInfo", None, Unset] = UNSET + peers: list[Peer] + composition_info: CompositionInfo | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -50,7 +46,7 @@ def to_dict(self) -> dict[str, Any]: peers_item = peers_item_data.to_dict() peers.append(peers_item) - composition_info: Union[None, Unset, dict[str, Any]] + composition_info: dict[str, Any] | None | Unset if isinstance(self.composition_info, Unset): composition_info = UNSET elif isinstance(self.composition_info, CompositionInfo): @@ -88,9 +84,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: peers.append(peers_item) - def _parse_composition_info( - data: object, - ) -> Union["CompositionInfo", None, Unset]: + def _parse_composition_info(data: object) -> CompositionInfo | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -103,9 +97,9 @@ def _parse_composition_info( ) return componentsschemas_composition_info_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["CompositionInfo", None, Unset], data) + return cast(CompositionInfo | None | Unset, data) composition_info = _parse_composition_info(d.pop("compositionInfo", UNSET)) diff --git a/fishjam/_openapi_client/models/room_config.py b/fishjam/_openapi_client/models/room_config.py index 1342a86..3643529 100644 --- a/fishjam/_openapi_client/models/room_config.py +++ b/fishjam/_openapi_client/models/room_config.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - Union, - cast, -) +from typing import Any, TypeVar, cast from attrs import define as _attrs_define @@ -20,22 +17,22 @@ class RoomConfig: """Room configuration Attributes: - max_peers (Union[None, Unset, int]): Maximum amount of peers allowed into the room Example: 10. - public (Union[Unset, bool]): True if livestream viewers can omit specifying a token. Default: False. - room_type (Union[Unset, RoomType]): The use-case of the room. If not provided, this defaults to conference. - video_codec (Union[Unset, VideoCodec]): Enforces video codec for each peer in the room - webhook_url (Union[None, Unset, str]): URL where Fishjam notifications will be sent Example: + max_peers (int | None | Unset): Maximum amount of peers allowed into the room Example: 10. + public (bool | Unset): True if livestream viewers can omit specifying a token. Default: False. + room_type (RoomType | Unset): The use-case of the room. If not provided, this defaults to conference. + video_codec (VideoCodec | Unset): Enforces video codec for each peer in the room + webhook_url (None | str | Unset): URL where Fishjam notifications will be sent Example: https://backend.address.com/fishjam-notifications-endpoint. """ - max_peers: Union[None, Unset, int] = UNSET - public: Union[Unset, bool] = False - room_type: Union[Unset, RoomType] = UNSET - video_codec: Union[Unset, VideoCodec] = UNSET - webhook_url: Union[None, Unset, str] = UNSET + max_peers: int | None | Unset = UNSET + public: bool | Unset = False + room_type: RoomType | Unset = UNSET + video_codec: VideoCodec | Unset = UNSET + webhook_url: None | str | Unset = UNSET def to_dict(self) -> dict[str, Any]: - max_peers: Union[None, Unset, int] + max_peers: int | None | Unset if isinstance(self.max_peers, Unset): max_peers = UNSET else: @@ -43,15 +40,15 @@ def to_dict(self) -> dict[str, Any]: public = self.public - room_type: Union[Unset, str] = UNSET + room_type: str | Unset = UNSET if not isinstance(self.room_type, Unset): room_type = self.room_type.value - video_codec: Union[Unset, str] = UNSET + video_codec: str | Unset = UNSET if not isinstance(self.video_codec, Unset): video_codec = self.video_codec.value - webhook_url: Union[None, Unset, str] + webhook_url: None | str | Unset if isinstance(self.webhook_url, Unset): webhook_url = UNSET else: @@ -77,37 +74,37 @@ def to_dict(self) -> dict[str, Any]: def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - def _parse_max_peers(data: object) -> Union[None, Unset, int]: + def _parse_max_peers(data: object) -> int | None | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, int], data) + return cast(int | None | Unset, data) max_peers = _parse_max_peers(d.pop("maxPeers", UNSET)) public = d.pop("public", UNSET) _room_type = d.pop("roomType", UNSET) - room_type: Union[Unset, RoomType] + room_type: RoomType | Unset if isinstance(_room_type, Unset): room_type = UNSET else: room_type = RoomType(_room_type) _video_codec = d.pop("videoCodec", UNSET) - video_codec: Union[Unset, VideoCodec] + video_codec: VideoCodec | Unset if isinstance(_video_codec, Unset): video_codec = UNSET else: video_codec = VideoCodec(_video_codec) - def _parse_webhook_url(data: object) -> Union[None, Unset, str]: + def _parse_webhook_url(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) webhook_url = _parse_webhook_url(d.pop("webhookUrl", UNSET)) diff --git a/fishjam/_openapi_client/models/room_create_details_response.py b/fishjam/_openapi_client/models/room_create_details_response.py index 89c01f5..b075a7a 100644 --- a/fishjam/_openapi_client/models/room_create_details_response.py +++ b/fishjam/_openapi_client/models/room_create_details_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,7 +21,7 @@ class RoomCreateDetailsResponse: data (RoomCreateDetailsResponseData): """ - data: "RoomCreateDetailsResponseData" + data: RoomCreateDetailsResponseData additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/room_create_details_response_data.py b/fishjam/_openapi_client/models/room_create_details_response_data.py index bcab900..57a4ec5 100644 --- a/fishjam/_openapi_client/models/room_create_details_response_data.py +++ b/fishjam/_openapi_client/models/room_create_details_response_data.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -22,7 +20,7 @@ class RoomCreateDetailsResponseData: room (Room): Description of the room state """ - room: "Room" + room: Room additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/room_details_response.py b/fishjam/_openapi_client/models/room_details_response.py index e1b23ef..722a654 100644 --- a/fishjam/_openapi_client/models/room_details_response.py +++ b/fishjam/_openapi_client/models/room_details_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,7 +21,7 @@ class RoomDetailsResponse: data (Room): Description of the room state """ - data: "Room" + data: Room additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/rooms_listing_response.py b/fishjam/_openapi_client/models/rooms_listing_response.py index 89d647b..d096fec 100644 --- a/fishjam/_openapi_client/models/rooms_listing_response.py +++ b/fishjam/_openapi_client/models/rooms_listing_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,10 +18,10 @@ class RoomsListingResponse: """Response containing list of all rooms Attributes: - data (list['Room']): + data (list[Room]): """ - data: list["Room"] + data: list[Room] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/stream.py b/fishjam/_openapi_client/models/stream.py index 4f85dd3..a751590 100644 --- a/fishjam/_openapi_client/models/stream.py +++ b/fishjam/_openapi_client/models/stream.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -26,16 +23,16 @@ class Stream: Attributes: id (str): Assigned stream id public (bool): - streamers (list['Streamer']): List of all streamers - viewers (list['Viewer']): List of all viewers - audio_only (Union[Unset, bool]): True if stream is restricted to audio only + streamers (list[Streamer]): List of all streamers + viewers (list[Viewer]): List of all viewers + audio_only (bool | Unset): True if stream is restricted to audio only """ id: str public: bool - streamers: list["Streamer"] - viewers: list["Viewer"] - audio_only: Union[Unset, bool] = UNSET + streamers: list[Streamer] + viewers: list[Viewer] + audio_only: bool | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/stream_config.py b/fishjam/_openapi_client/models/stream_config.py index 8351355..b0c699a 100644 --- a/fishjam/_openapi_client/models/stream_config.py +++ b/fishjam/_openapi_client/models/stream_config.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - Union, - cast, -) +from typing import Any, TypeVar, cast from attrs import define as _attrs_define @@ -18,17 +15,17 @@ class StreamConfig: """Stream configuration Attributes: - audio_only (Union[None, Unset, bool]): Restrics stream to audio only Default: False. - public (Union[Unset, bool]): True if livestream viewers can omit specifying a token. Default: False. - webhook_url (Union[None, Unset, str]): Webhook URL for receiving server notifications + audio_only (bool | None | Unset): Restrics stream to audio only Default: False. + public (bool | Unset): True if livestream viewers can omit specifying a token. Default: False. + webhook_url (None | str | Unset): Webhook URL for receiving server notifications """ - audio_only: Union[None, Unset, bool] = False - public: Union[Unset, bool] = False - webhook_url: Union[None, Unset, str] = UNSET + audio_only: bool | None | Unset = False + public: bool | Unset = False + webhook_url: None | str | Unset = UNSET def to_dict(self) -> dict[str, Any]: - audio_only: Union[None, Unset, bool] + audio_only: bool | None | Unset if isinstance(self.audio_only, Unset): audio_only = UNSET else: @@ -36,7 +33,7 @@ def to_dict(self) -> dict[str, Any]: public = self.public - webhook_url: Union[None, Unset, str] + webhook_url: None | str | Unset if isinstance(self.webhook_url, Unset): webhook_url = UNSET else: @@ -58,23 +55,23 @@ def to_dict(self) -> dict[str, Any]: def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - def _parse_audio_only(data: object) -> Union[None, Unset, bool]: + def _parse_audio_only(data: object) -> bool | None | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, bool], data) + return cast(bool | None | Unset, data) audio_only = _parse_audio_only(d.pop("audioOnly", UNSET)) public = d.pop("public", UNSET) - def _parse_webhook_url(data: object) -> Union[None, Unset, str]: + def _parse_webhook_url(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) webhook_url = _parse_webhook_url(d.pop("webhookUrl", UNSET)) diff --git a/fishjam/_openapi_client/models/stream_details_response.py b/fishjam/_openapi_client/models/stream_details_response.py index 030eb9f..e10edf8 100644 --- a/fishjam/_openapi_client/models/stream_details_response.py +++ b/fishjam/_openapi_client/models/stream_details_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,7 +21,7 @@ class StreamDetailsResponse: data (Stream): Describes stream status """ - data: "Stream" + data: Stream additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/streamer.py b/fishjam/_openapi_client/models/streamer.py index 61f7662..cbb92be 100644 --- a/fishjam/_openapi_client/models/streamer.py +++ b/fishjam/_openapi_client/models/streamer.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/streamer_details_response.py b/fishjam/_openapi_client/models/streamer_details_response.py index cc9bc9c..352af13 100644 --- a/fishjam/_openapi_client/models/streamer_details_response.py +++ b/fishjam/_openapi_client/models/streamer_details_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,7 +21,7 @@ class StreamerDetailsResponse: data (Streamer): Describes streamer status """ - data: "Streamer" + data: Streamer additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/streamer_token.py b/fishjam/_openapi_client/models/streamer_token.py index e675c0d..fa0f14d 100644 --- a/fishjam/_openapi_client/models/streamer_token.py +++ b/fishjam/_openapi_client/models/streamer_token.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/streams_listing_response.py b/fishjam/_openapi_client/models/streams_listing_response.py index d451de5..ba15f4b 100644 --- a/fishjam/_openapi_client/models/streams_listing_response.py +++ b/fishjam/_openapi_client/models/streams_listing_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,10 +18,10 @@ class StreamsListingResponse: """Response containing list of all streams Attributes: - data (list['Stream']): + data (list[Stream]): """ - data: list["Stream"] + data: list[Stream] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/subscribe_tracks_body.py b/fishjam/_openapi_client/models/subscribe_tracks_body.py index 8daacc1..7a6ebe4 100644 --- a/fishjam/_openapi_client/models/subscribe_tracks_body.py +++ b/fishjam/_openapi_client/models/subscribe_tracks_body.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - cast, -) +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field diff --git a/fishjam/_openapi_client/models/subscriptions.py b/fishjam/_openapi_client/models/subscriptions.py index 82f61d3..80a1338 100644 --- a/fishjam/_openapi_client/models/subscriptions.py +++ b/fishjam/_openapi_client/models/subscriptions.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - cast, -) +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field diff --git a/fishjam/_openapi_client/models/track.py b/fishjam/_openapi_client/models/track.py index 221d0df..f668858 100644 --- a/fishjam/_openapi_client/models/track.py +++ b/fishjam/_openapi_client/models/track.py @@ -1,11 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, - Union, - cast, -) +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -25,14 +21,14 @@ class Track: """Describes media track of a Peer Attributes: - id (Union[Unset, str]): Assigned track id Example: 8dbd2e6b-a1e7-4670-95a2-0262aa6c6321. - metadata (Union['TrackMetadata', None, Unset]): Example: {'source': 'camera'}. - type_ (Union[Unset, TrackType]): + id (str | Unset): Assigned track id Example: 8dbd2e6b-a1e7-4670-95a2-0262aa6c6321. + metadata (None | TrackMetadata | Unset): Example: {'source': 'camera'}. + type_ (TrackType | Unset): """ - id: Union[Unset, str] = UNSET - metadata: Union["TrackMetadata", None, Unset] = UNSET - type_: Union[Unset, TrackType] = UNSET + id: str | Unset = UNSET + metadata: None | TrackMetadata | Unset = UNSET + type_: TrackType | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -40,7 +36,7 @@ def to_dict(self) -> dict[str, Any]: id = self.id - metadata: Union[None, Unset, dict[str, Any]] + metadata: dict[str, Any] | None | Unset if isinstance(self.metadata, Unset): metadata = UNSET elif isinstance(self.metadata, TrackMetadata): @@ -48,7 +44,7 @@ def to_dict(self) -> dict[str, Any]: else: metadata = self.metadata - type_: Union[Unset, str] = UNSET + type_: str | Unset = UNSET if not isinstance(self.type_, Unset): type_ = self.type_.value @@ -71,7 +67,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) id = d.pop("id", UNSET) - def _parse_metadata(data: object) -> Union["TrackMetadata", None, Unset]: + def _parse_metadata(data: object) -> None | TrackMetadata | Unset: if data is None: return data if isinstance(data, Unset): @@ -82,14 +78,14 @@ def _parse_metadata(data: object) -> Union["TrackMetadata", None, Unset]: componentsschemas_track_metadata_type_0 = TrackMetadata.from_dict(data) return componentsschemas_track_metadata_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["TrackMetadata", None, Unset], data) + return cast(None | TrackMetadata | Unset, data) metadata = _parse_metadata(d.pop("metadata", UNSET)) _type_ = d.pop("type", UNSET) - type_: Union[Unset, TrackType] + type_: TrackType | Unset if isinstance(_type_, Unset): type_ = UNSET else: diff --git a/fishjam/_openapi_client/models/track_forwarding.py b/fishjam/_openapi_client/models/track_forwarding.py index ebbe3c4..e2de4c0 100644 --- a/fishjam/_openapi_client/models/track_forwarding.py +++ b/fishjam/_openapi_client/models/track_forwarding.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - Union, -) +from typing import Any, TypeVar from attrs import define as _attrs_define @@ -18,12 +16,12 @@ class TrackForwarding: Attributes: composition_url (str): URL for the composition - selector (Union[Unset, str]): Selects tracks that should be forwarded, currently only "all" is supported - Default: 'all'. + selector (str | Unset): Selects tracks that should be forwarded, currently only "all" is supported Default: + 'all'. """ composition_url: str - selector: Union[Unset, str] = "all" + selector: str | Unset = "all" def to_dict(self) -> dict[str, Any]: composition_url = self.composition_url diff --git a/fishjam/_openapi_client/models/track_forwarding_info.py b/fishjam/_openapi_client/models/track_forwarding_info.py index 7a166ff..d4e71c9 100644 --- a/fishjam/_openapi_client/models/track_forwarding_info.py +++ b/fishjam/_openapi_client/models/track_forwarding_info.py @@ -1,10 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - Any, - TypeVar, - Union, - cast, -) +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -21,14 +18,14 @@ class TrackForwardingInfo: Attributes: input_id (str): Input ID used by the composition Example: input-1. peer_id (str): Peer ID Example: peer-1. - audio_track_id (Union[None, Unset, str]): ID of the forwarded audio track Example: track-audio-1. - video_track_id (Union[None, Unset, str]): ID of the forwarded video track Example: track-video-1. + audio_track_id (None | str | Unset): ID of the forwarded audio track Example: track-audio-1. + video_track_id (None | str | Unset): ID of the forwarded video track Example: track-video-1. """ input_id: str peer_id: str - audio_track_id: Union[None, Unset, str] = UNSET - video_track_id: Union[None, Unset, str] = UNSET + audio_track_id: None | str | Unset = UNSET + video_track_id: None | str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -36,13 +33,13 @@ def to_dict(self) -> dict[str, Any]: peer_id = self.peer_id - audio_track_id: Union[None, Unset, str] + audio_track_id: None | str | Unset if isinstance(self.audio_track_id, Unset): audio_track_id = UNSET else: audio_track_id = self.audio_track_id - video_track_id: Union[None, Unset, str] + video_track_id: None | str | Unset if isinstance(self.video_track_id, Unset): video_track_id = UNSET else: @@ -68,21 +65,21 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: peer_id = d.pop("peerId") - def _parse_audio_track_id(data: object) -> Union[None, Unset, str]: + def _parse_audio_track_id(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) audio_track_id = _parse_audio_track_id(d.pop("audioTrackId", UNSET)) - def _parse_video_track_id(data: object) -> Union[None, Unset, str]: + def _parse_video_track_id(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) video_track_id = _parse_video_track_id(d.pop("videoTrackId", UNSET)) diff --git a/fishjam/_openapi_client/models/track_metadata.py b/fishjam/_openapi_client/models/track_metadata.py index f0306b3..70bea5e 100644 --- a/fishjam/_openapi_client/models/track_metadata.py +++ b/fishjam/_openapi_client/models/track_metadata.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/viewer.py b/fishjam/_openapi_client/models/viewer.py index a787c5b..435c98a 100644 --- a/fishjam/_openapi_client/models/viewer.py +++ b/fishjam/_openapi_client/models/viewer.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/viewer_details_response.py b/fishjam/_openapi_client/models/viewer_details_response.py index b9fc1ca..9ed1969 100644 --- a/fishjam/_openapi_client/models/viewer_details_response.py +++ b/fishjam/_openapi_client/models/viewer_details_response.py @@ -1,9 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import ( - TYPE_CHECKING, - Any, - TypeVar, -) +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,7 +21,7 @@ class ViewerDetailsResponse: data (Viewer): Describes viewer status """ - data: "Viewer" + data: Viewer additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/fishjam/_openapi_client/models/viewer_token.py b/fishjam/_openapi_client/models/viewer_token.py index dee5c4a..db54ad8 100644 --- a/fishjam/_openapi_client/models/viewer_token.py +++ b/fishjam/_openapi_client/models/viewer_token.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/models/web_rtc_metadata.py b/fishjam/_openapi_client/models/web_rtc_metadata.py index 4e234fc..768380d 100644 --- a/fishjam/_openapi_client/models/web_rtc_metadata.py +++ b/fishjam/_openapi_client/models/web_rtc_metadata.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/fishjam/_openapi_client/types.py b/fishjam/_openapi_client/types.py index 1b96ca4..b64af09 100644 --- a/fishjam/_openapi_client/types.py +++ b/fishjam/_openapi_client/types.py @@ -2,7 +2,7 @@ from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -15,13 +15,13 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() # The types that `httpx.Client(files=)` can accept, copied from that library. -FileContent = Union[IO[bytes], bytes, str] -FileTypes = Union[ +FileContent = IO[bytes] | bytes | str +FileTypes = ( # (filename, file (or bytes), content_type) - tuple[Optional[str], FileContent, Optional[str]], + tuple[str | None, FileContent, str | None] # (filename, file (or bytes), content_type, headers) - tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], -] + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) RequestFiles = list[tuple[str, FileTypes]] @@ -30,8 +30,8 @@ class File: """Contains information for file uploads""" payload: BinaryIO - file_name: Optional[str] = None - mime_type: Optional[str] = None + file_name: str | None = None + mime_type: str | None = None def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" @@ -48,7 +48,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: Optional[T] + parsed: T | None __all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/pyproject.toml b/pyproject.toml index 1c72c31..fd150fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "fishjam-server-sdk" -version = "0.25.0" +version = "0.26.0" description = "Python server SDK for the Fishjam" authors = [{ name = "Fishjam Team", email = "contact@fishjam.io" }] requires-python = ">=3.11" @@ -41,7 +41,7 @@ dev = [ "pdoc>=15.0.0,<16", "mkdocs>=1.5.3,<2", "mike>=2.0.0,<3", - "openapi-python-client>=0.25.0,<0.26", + "openapi-python-client>=0.28.0,<0.29", "ruff==0.12", "flask>=3.0.3,<4", "pyright>=1.1.383,<2", @@ -52,7 +52,7 @@ test = [ "pytest-asyncio>=0.21.1,<0.22", "requests>=2.31.0,<3", "flask>=3.0.3,<4", - "google-genai>=1.43.0" + "google-genai>=1.43.0", ] [tool.uv] diff --git a/uv.lock b/uv.lock index f0b74f5..40682af 100644 --- a/uv.lock +++ b/uv.lock @@ -324,7 +324,7 @@ wheels = [ [[package]] name = "fishjam-server-sdk" -version = "0.25.0" +version = "0.26.0" source = { editable = "." } dependencies = [ { name = "aenum" }, @@ -382,7 +382,7 @@ dev = [ { name = "flask", specifier = ">=3.0.3,<4" }, { name = "mike", specifier = ">=2.0.0,<3" }, { name = "mkdocs", specifier = ">=1.5.3,<2" }, - { name = "openapi-python-client", specifier = ">=0.25.0,<0.26" }, + { name = "openapi-python-client", specifier = ">=0.28.0,<0.29" }, { name = "pdoc", specifier = ">=15.0.0,<16" }, { name = "pre-commit", specifier = "==4.5.0" }, { name = "pyright", specifier = ">=1.1.383,<2" }, @@ -1245,7 +1245,7 @@ voice = [ [[package]] name = "openapi-python-client" -version = "0.25.3" +version = "0.28.3" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "attrs" }, @@ -1258,11 +1258,10 @@ dependencies = [ { name = "ruff" }, { name = "shellingham" }, { name = "typer" }, - { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f9/af/df5579c9a3cf515501518634c9c2004fa0999a810a0ef1145fa3bc82beac/openapi_python_client-0.25.3.tar.gz", hash = "sha256:cafc6b5aebd0c55fe7be4d400b24d3b107f7ec64923b8117ef8aa7ceb2a918a4", size = 124703, upload-time = "2025-07-28T01:25:53.66Z" } +sdist = { url = "https://files.pythonhosted.org/packages/98/3c/03b6a9f8a056c748e151d3ff9dbc78236051fb7f8d48129aa19dce239e7b/openapi_python_client-0.28.3.tar.gz", hash = "sha256:c443df7cabf7d260feddb21626c0ff7bd83f5747453d10164f7c88d98e89c3d7", size = 125957, upload-time = "2026-03-05T23:45:13.043Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/5f/d2/539333a5cf2f14f5dd9aa8a3a73a4029464328e3f6ac4350577a28ea08ce/openapi_python_client-0.25.3-py3-none-any.whl", hash = "sha256:008e4c5f3079f312c135b55b142eb9616eafbd739ad6d5f8e95add726d1a02f2", size = 182159, upload-time = "2025-07-28T01:25:51.941Z" }, + { url = "https://files.pythonhosted.org/packages/ba/a0/99db160a52ee98302c9e231d33afce350386eb2b6ee21de2b329f7bd4286/openapi_python_client-0.28.3-py3-none-any.whl", hash = "sha256:fbb29976a3d0fcea2822fdd7504b7437825dd4f075f2412dd234882c4a56d469", size = 183193, upload-time = "2026-03-05T23:45:11.458Z" }, ] [[package]] From 362247a9f20066ffd58eab8f2d254a6f909ecf47 Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:52:03 +0200 Subject: [PATCH 02/10] Fix tests --- .github/workflows/ci.yml | 11 ++++++----- tests/support/webhook_notifier.py | 11 ++++++----- tests/test_notifier.py | 31 ++++++++++++++++++++----------- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b6e312..8caf536 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,13 +55,14 @@ jobs: - name: Initialize Localtunnel id: tunnel run: | - npx localtunnel --port 5000 > tunnel.log 2>&1 & - + npm install -g localtunnel + localtunnel --port 5000 > tunnel.log 2>&1 & + # Poll for the URL - TIMEOUT=10 + TIMEOUT=15 ELAPSED=0 echo "Waiting for localtunnel to generate URL..." - + while ! grep -q "https://" tunnel.log; do if [ $ELAPSED -ge $TIMEOUT ]; then echo "Error: Localtunnel timed out after ${TIMEOUT}s" @@ -71,7 +72,7 @@ jobs: sleep 1 ELAPSED=$((ELAPSED + 1)) done - + TUNNEL_URL=$(grep -o 'https://[^ ]*' tunnel.log | head -n 1) echo "url=$TUNNEL_URL" >> $GITHUB_OUTPUT echo "Localtunnel is live at: $TUNNEL_URL" diff --git a/tests/support/webhook_notifier.py b/tests/support/webhook_notifier.py index 4f0419c..7bc6760 100644 --- a/tests/support/webhook_notifier.py +++ b/tests/support/webhook_notifier.py @@ -5,7 +5,7 @@ from fishjam import receive_binary app = Flask(__name__) -DATA_QUEUE = None +QUEUES = None @app.route("/", methods=["GET"]) @@ -17,12 +17,13 @@ def respond_default(): def respond_root(): data = request.get_data() msg = receive_binary(data) - DATA_QUEUE.put(msg) + for q in QUEUES: + q.put(msg) return Response(status=200) -def run_server(queue): - global DATA_QUEUE - DATA_QUEUE = queue +def run_server(queues): + global QUEUES + QUEUES = queues app.run(port=5000, host="0.0.0.0", use_reloader=False, debug=False, threaded=True) diff --git a/tests/test_notifier.py b/tests/test_notifier.py index 5879a1a..ca52673 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -1,7 +1,7 @@ # pylint: disable=locally-disabled, missing-class-docstring, missing-function-docstring, redefined-outer-name, too-few-public-methods, missing-module-docstring import asyncio -from multiprocessing import Process, Queue +from multiprocessing import Manager, Process import pytest import requests @@ -28,12 +28,13 @@ from tests.support.peer_socket import PeerSocket from tests.support.webhook_notifier import run_server -queue = Queue() +_manager = Manager() +_queues = _manager.list() @pytest.fixture(scope="session", autouse=True) def start_server(): - flask_process = Process(target=run_server, args=(queue,)) + flask_process = Process(target=run_server, args=(_queues,)) flask_process.start() session = requests.Session() @@ -55,6 +56,14 @@ def start_server(): flask_process.terminate() +@pytest.fixture +def event_queue(): + q = _manager.Queue() + _queues.append(q) + yield q + _queues.remove(q) + + class TestConnectingToServer: @pytest.mark.asyncio async def test_valid_credentials(self): @@ -97,7 +106,7 @@ def notifier(): class TestReceivingNotifications: @pytest.mark.asyncio async def test_room_created_deleted( - self, room_api: FishjamClient, notifier: FishjamNotifier + self, room_api: FishjamClient, notifier: FishjamNotifier, event_queue ): event_checks = [ServerMessageRoomCreated, ServerMessageRoomDeleted] @@ -117,11 +126,11 @@ async def test_room_created_deleted( notifier_task.cancel() for event in event_checks: - self.assert_event(event) + self.assert_event(event, event_queue) @pytest.mark.asyncio async def test_peer_connected_disconnected( - self, room_api: FishjamClient, notifier: FishjamNotifier + self, room_api: FishjamClient, notifier: FishjamNotifier, event_queue ): event_checks = [ ServerMessageRoomCreated, @@ -156,11 +165,11 @@ async def test_peer_connected_disconnected( peer_socket_task.cancel() for event in event_checks: - self.assert_event(event) + self.assert_event(event, event_queue) @pytest.mark.asyncio async def test_peer_connected_room_deleted( - self, room_api: FishjamClient, notifier: FishjamNotifier + self, room_api: FishjamClient, notifier: FishjamNotifier, event_queue ): event_checks = [ ServerMessageRoomCreated, @@ -193,8 +202,8 @@ async def test_peer_connected_room_deleted( peer_socket_task.cancel() for event in event_checks: - self.assert_event(event) + self.assert_event(event, event_queue) - def assert_event(self, event): - data = queue.get(timeout=5) + def assert_event(self, event, event_queue): + data = event_queue.get(timeout=5) assert data == event or isinstance(data, event) From 3e29a523197ad005c22fac2b15d4a37bd1a7ee2c Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:03:11 +0200 Subject: [PATCH 03/10] Fix localtunnel command --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8caf536..0f1a8b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: id: tunnel run: | npm install -g localtunnel - localtunnel --port 5000 > tunnel.log 2>&1 & + npm exec localtunnel --port 5000 > tunnel.log 2>&1 & # Poll for the URL TIMEOUT=15 From c3c8d9417f444a19f2aac10b3cf5b6099fb068ec Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:08:51 +0200 Subject: [PATCH 04/10] Add artifact --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f1a8b0..d61f084 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,3 +83,10 @@ jobs: WEBHOOK_SERVER_URL: ${{ steps.tunnel.outputs.url }} FISHJAM_ID: ${{ secrets.CI_FISHJAM_ID }} FISHJAM_MANAGEMENT_TOKEN: ${{ secrets.CI_FISHJAM_MANAGEMENT_TOKEN }} + + - name: Upload localtunnel log + if: always() + uses: actions/upload-artifact@v4 + with: + name: localtunnel-log-py${{ matrix.python-version }} + path: tunnel.log From 4563f6826b6d8e70267c2d1412c52ceccf632567 Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:10:02 +0200 Subject: [PATCH 05/10] Fix arguments parsing --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d61f084..fd68984 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: id: tunnel run: | npm install -g localtunnel - npm exec localtunnel --port 5000 > tunnel.log 2>&1 & + npm exec localtunnel -- --port 5000 > tunnel.log 2>&1 & # Poll for the URL TIMEOUT=15 From 88dcdc5dc2f85b26c5069d2db341f9cdd07e5c72 Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:11:28 +0200 Subject: [PATCH 06/10] Move localtunnel log upload before tests --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd68984..fc0b2cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,16 +77,16 @@ jobs: echo "url=$TUNNEL_URL" >> $GITHUB_OUTPUT echo "Localtunnel is live at: $TUNNEL_URL" - - name: Run tests - run: uv run pytest - env: - WEBHOOK_SERVER_URL: ${{ steps.tunnel.outputs.url }} - FISHJAM_ID: ${{ secrets.CI_FISHJAM_ID }} - FISHJAM_MANAGEMENT_TOKEN: ${{ secrets.CI_FISHJAM_MANAGEMENT_TOKEN }} - - name: Upload localtunnel log if: always() uses: actions/upload-artifact@v4 with: name: localtunnel-log-py${{ matrix.python-version }} path: tunnel.log + + - name: Run tests + run: uv run pytest + env: + WEBHOOK_SERVER_URL: ${{ steps.tunnel.outputs.url }} + FISHJAM_ID: ${{ secrets.CI_FISHJAM_ID }} + FISHJAM_MANAGEMENT_TOKEN: ${{ secrets.CI_FISHJAM_MANAGEMENT_TOKEN }} From 892856f0a6e5ab59dd2c1cf47d2be6ce5f52477b Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:57:03 +0200 Subject: [PATCH 07/10] Make tests less flaky --- tests/support/asyncio_utils.py | 2 +- tests/support/webhook_notifier.py | 5 +++-- tests/test_notifier.py | 27 +++++++++++++++++---------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/tests/support/asyncio_utils.py b/tests/support/asyncio_utils.py index e5c091d..36707f9 100644 --- a/tests/support/asyncio_utils.py +++ b/tests/support/asyncio_utils.py @@ -4,7 +4,7 @@ from fishjam import FishjamNotifier -ASSERTION_TIMEOUT = 5.0 +ASSERTION_TIMEOUT = 15.0 async def assert_events(notifier: FishjamNotifier, event_checks: list): diff --git a/tests/support/webhook_notifier.py b/tests/support/webhook_notifier.py index 7bc6760..91f8d3d 100644 --- a/tests/support/webhook_notifier.py +++ b/tests/support/webhook_notifier.py @@ -17,8 +17,9 @@ def respond_default(): def respond_root(): data = request.get_data() msg = receive_binary(data) - for q in QUEUES: - q.put(msg) + if msg is not None: + for q in QUEUES.values(): + q.put(msg) return Response(status=200) diff --git a/tests/test_notifier.py b/tests/test_notifier.py index ca52673..044acd4 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -1,6 +1,7 @@ # pylint: disable=locally-disabled, missing-class-docstring, missing-function-docstring, redefined-outer-name, too-few-public-methods, missing-module-docstring import asyncio +import uuid from multiprocessing import Manager, Process import pytest @@ -29,7 +30,7 @@ from tests.support.webhook_notifier import run_server _manager = Manager() -_queues = _manager.list() +_queues = _manager.dict() @pytest.fixture(scope="session", autouse=True) @@ -59,9 +60,10 @@ def start_server(): @pytest.fixture def event_queue(): q = _manager.Queue() - _queues.append(q) + key = str(uuid.uuid4()) + _queues[key] = q yield q - _queues.remove(q) + del _queues[key] class TestConnectingToServer: @@ -126,7 +128,7 @@ async def test_room_created_deleted( notifier_task.cancel() for event in event_checks: - self.assert_event(event, event_queue) + self.assert_event(event, event_queue, room.id) @pytest.mark.asyncio async def test_peer_connected_disconnected( @@ -165,7 +167,7 @@ async def test_peer_connected_disconnected( peer_socket_task.cancel() for event in event_checks: - self.assert_event(event, event_queue) + self.assert_event(event, event_queue, room.id) @pytest.mark.asyncio async def test_peer_connected_room_deleted( @@ -202,8 +204,13 @@ async def test_peer_connected_room_deleted( peer_socket_task.cancel() for event in event_checks: - self.assert_event(event, event_queue) - - def assert_event(self, event, event_queue): - data = event_queue.get(timeout=5) - assert data == event or isinstance(data, event) + self.assert_event(event, event_queue, room.id) + + def assert_event(self, event, event_queue, room_id=None): + for _ in range(20): + data = event_queue.get(timeout=10) + if room_id and data.room_id != room_id: + continue + assert data == event or isinstance(data, event), ( + f"Expected {event} but last received: {data}" + ) From e412c78aa02798874881e0cc190995534c0e4af9 Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:59:46 +0200 Subject: [PATCH 08/10] Fail tests later --- tests/test_notifier.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_notifier.py b/tests/test_notifier.py index 044acd4..06c001d 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -211,6 +211,6 @@ def assert_event(self, event, event_queue, room_id=None): data = event_queue.get(timeout=10) if room_id and data.room_id != room_id: continue - assert data == event or isinstance(data, event), ( - f"Expected {event} but last received: {data}" - ) + if data == event or isinstance(data, event): + return + raise AssertionError(f"Expected {event} but last received: {data}") From daf0b4c9bdba2d564f4954237ad398db906a935f Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:43:20 +0200 Subject: [PATCH 09/10] Timeout on all events, not on each --- tests/test_notifier.py | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/tests/test_notifier.py b/tests/test_notifier.py index 06c001d..08eb34d 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -1,6 +1,8 @@ # pylint: disable=locally-disabled, missing-class-docstring, missing-function-docstring, redefined-outer-name, too-few-public-methods, missing-module-docstring import asyncio +import queue +import time import uuid from multiprocessing import Manager, Process @@ -127,8 +129,7 @@ async def test_room_created_deleted( notifier_task.cancel() - for event in event_checks: - self.assert_event(event, event_queue, room.id) + self.assert_webhook_events(event_checks, event_queue, room.id) @pytest.mark.asyncio async def test_peer_connected_disconnected( @@ -166,8 +167,7 @@ async def test_peer_connected_disconnected( notifier_task.cancel() peer_socket_task.cancel() - for event in event_checks: - self.assert_event(event, event_queue, room.id) + self.assert_webhook_events(event_checks, event_queue, room.id) @pytest.mark.asyncio async def test_peer_connected_room_deleted( @@ -203,14 +203,31 @@ async def test_peer_connected_room_deleted( notifier_task.cancel() peer_socket_task.cancel() - for event in event_checks: - self.assert_event(event, event_queue, room.id) + self.assert_webhook_events(event_checks, event_queue, room.id) - def assert_event(self, event, event_queue, room_id=None): - for _ in range(20): - data = event_queue.get(timeout=10) + def assert_webhook_events(self, event_checks, event_queue, room_id, timeout=30): + deadline = time.monotonic() + timeout + received = [] + + pos = 0 + while pos < len(event_checks) and time.monotonic() < deadline: + remaining = deadline - time.monotonic() + + try: + data = event_queue.get(timeout=remaining) + except queue.Empty: + continue if room_id and data.room_id != room_id: continue - if data == event or isinstance(data, event): - return - raise AssertionError(f"Expected {event} but last received: {data}") + + received.append(data) + if data == event_checks[pos] or isinstance(data, event_checks[pos]): + pos += 1 + + if pos >= len(event_checks): + return + + raise AssertionError( + f"Expected event {event_checks[pos]} not found. " + f"Received: {[type(e).__name__ for e in received]}" + ) From f77b03f0eed44437f363a206fd6efae00270f620 Mon Sep 17 00:00:00 2001 From: Tomasz Mazur <47872060+AHGIJMKLKKZNPJKQR@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:48:16 +0200 Subject: [PATCH 10/10] Increase timeout --- tests/test_notifier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_notifier.py b/tests/test_notifier.py index 08eb34d..fba0b96 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -205,7 +205,7 @@ async def test_peer_connected_room_deleted( self.assert_webhook_events(event_checks, event_queue, room.id) - def assert_webhook_events(self, event_checks, event_queue, room_id, timeout=30): + def assert_webhook_events(self, event_checks, event_queue, room_id, timeout=60): deadline = time.monotonic() + timeout received = []