From 873d432855503d36062426cc49b55bcdf3c93b06 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Tue, 10 Jun 2025 14:49:01 +0200 Subject: [PATCH 1/3] Rename room types broadcaster -> livestream, full_feature -> conference --- examples/room_manager/room_service.py | 2 +- fishjam/_openapi_client/api/viewer/generate_token.py | 8 ++++---- fishjam/_openapi_client/models/room_config.py | 4 ++-- fishjam/_openapi_client/models/room_config_room_type.py | 4 +++- fishjam/_openapi_client/models/viewer_token.py | 2 +- fishjam/api/_fishjam_client.py | 9 ++------- tests/test_room_api.py | 9 +++++---- 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/examples/room_manager/room_service.py b/examples/room_manager/room_service.py index af03130..4b96ff8 100644 --- a/examples/room_manager/room_service.py +++ b/examples/room_manager/room_service.py @@ -81,7 +81,7 @@ def __find_or_create_room( options = RoomOptions( max_peers=self.config.max_peers, webhook_url=self.config.webhook_url, - room_type=room_type.value if room_type else "full_feature", + room_type=room_type.value if room_type else "conference", ) new_room = self.fishjam_client.create_room(options=options) diff --git a/fishjam/_openapi_client/api/viewer/generate_token.py b/fishjam/_openapi_client/api/viewer/generate_token.py index f1d0279..d22f1b0 100644 --- a/fishjam/_openapi_client/api/viewer/generate_token.py +++ b/fishjam/_openapi_client/api/viewer/generate_token.py @@ -66,7 +66,7 @@ def sync_detailed( *, client: Union[AuthenticatedClient, Client], ) -> Response[Union[Error, ViewerToken]]: - """Generate single broadcaster access token + """Generate single livestream access token Args: room_id (str): @@ -95,7 +95,7 @@ def sync( *, client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Error, ViewerToken]]: - """Generate single broadcaster access token + """Generate single livestream access token Args: room_id (str): @@ -119,7 +119,7 @@ async def asyncio_detailed( *, client: Union[AuthenticatedClient, Client], ) -> Response[Union[Error, ViewerToken]]: - """Generate single broadcaster access token + """Generate single livestream access token Args: room_id (str): @@ -146,7 +146,7 @@ async def asyncio( *, client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Error, ViewerToken]]: - """Generate single broadcaster access token + """Generate single livestream access token Args: room_id (str): diff --git a/fishjam/_openapi_client/models/room_config.py b/fishjam/_openapi_client/models/room_config.py index 2239725..0183ee0 100644 --- a/fishjam/_openapi_client/models/room_config.py +++ b/fishjam/_openapi_client/models/room_config.py @@ -16,8 +16,8 @@ class RoomConfig: max_peers: Union[Unset, None, int] = UNSET """Maximum amount of peers allowed into the room""" - room_type: Union[Unset, RoomConfigRoomType] = RoomConfigRoomType.FULL_FEATURE - """The use-case of the room. If not provided, this defaults to full_feature.""" + room_type: Union[Unset, RoomConfigRoomType] = RoomConfigRoomType.CONFERENCE + """The use-case of the room. If not provided, this defaults to conference.""" video_codec: Union[Unset, None, RoomConfigVideoCodec] = UNSET """Enforces video codec for each peer in the room""" webhook_url: Union[Unset, None, str] = UNSET diff --git a/fishjam/_openapi_client/models/room_config_room_type.py b/fishjam/_openapi_client/models/room_config_room_type.py index 7f8821b..1eff10c 100644 --- a/fishjam/_openapi_client/models/room_config_room_type.py +++ b/fishjam/_openapi_client/models/room_config_room_type.py @@ -2,11 +2,13 @@ class RoomConfigRoomType(str, Enum): - """The use-case of the room. If not provided, this defaults to full_feature.""" + """The use-case of the room. If not provided, this defaults to conference.""" AUDIO_ONLY = "audio_only" BROADCASTER = "broadcaster" + CONFERENCE = "conference" FULL_FEATURE = "full_feature" + LIVESTREAM = "livestream" def __str__(self) -> str: return str(self.value) diff --git a/fishjam/_openapi_client/models/viewer_token.py b/fishjam/_openapi_client/models/viewer_token.py index d6c8295..924faf5 100644 --- a/fishjam/_openapi_client/models/viewer_token.py +++ b/fishjam/_openapi_client/models/viewer_token.py @@ -8,7 +8,7 @@ @_attrs_define class ViewerToken: - """Token for authorizing broadcaster viewer connection""" + """Token for authorizing livestream viewer connection""" token: str """None""" diff --git a/fishjam/api/_fishjam_client.py b/fishjam/api/_fishjam_client.py index 94118e6..0387ff8 100644 --- a/fishjam/api/_fishjam_client.py +++ b/fishjam/api/_fishjam_client.py @@ -55,10 +55,8 @@ class RoomOptions: """Enforces video codec for each peer in the room""" webhook_url: str | None = None """URL where Fishjam notifications will be sent""" - room_type: Literal[ - "full_feature", "audio_only", "broadcaster", "livestream" - ] = "full_feature" - """The use-case of the room. If not provided, this defaults to full_feature.""" + room_type: Literal["conference", "audio_only", "livestream"] = "conference" + """The use-case of the room. If not provided, this defaults to conference.""" @dataclass @@ -118,9 +116,6 @@ def create_room(self, options: RoomOptions | None = None) -> Room: if options.video_codec: codec = RoomConfigVideoCodec(options.video_codec) - if options.room_type == "livestream": - options.room_type = "broadcaster" - config = RoomConfig( max_peers=options.max_peers, video_codec=codec, diff --git a/tests/test_room_api.py b/tests/test_room_api.py index 6571177..8cad535 100644 --- a/tests/test_room_api.py +++ b/tests/test_room_api.py @@ -31,7 +31,8 @@ MAX_PEERS = 10 CODEC_H264 = "h264" AUDIO_ONLY = "audio_only" -FULL_FEATURE = "full_feature" +CONFERENCE = "conference" +LIVESTREAM = "livestream" class TestAuthentication: @@ -65,7 +66,7 @@ def test_no_params(self, room_api): max_peers=None, video_codec=None, webhook_url=None, - room_type=RoomConfigRoomType(FULL_FEATURE), + room_type=RoomConfigRoomType(CONFERENCE), ) config.__setitem__("roomId", room.config.__getitem__("roomId")) config.__setitem__( @@ -152,7 +153,7 @@ def test_valid(self, room_api: FishjamClient): max_peers=None, video_codec=None, webhook_url=None, - room_type=RoomConfigRoomType(FULL_FEATURE), + room_type=RoomConfigRoomType(CONFERENCE), ) config.__setitem__("roomId", room.config.__getitem__("roomId")) config.__setitem__( @@ -255,7 +256,7 @@ def test_invalid(self, room_api: FishjamClient): class TestCreateLivestreamViewerToken: def test_valid(self, room_api: FishjamClient): - room = room_api.create_room(RoomOptions(room_type="livestream")) + room = room_api.create_room(RoomOptions(room_type=LIVESTREAM)) viewer_token = room_api.create_livestream_viewer_token(room.id) assert isinstance(viewer_token, str) From 8b4d5f217524d496c51b8c5a969ee90897b392b5 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Tue, 10 Jun 2025 15:16:43 +0200 Subject: [PATCH 2/3] Fix lint warnings --- examples/room_manager/routes.py | 1 + fishjam/api/_fishjam_client.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/room_manager/routes.py b/examples/room_manager/routes.py index ce06645..f8c965b 100644 --- a/examples/room_manager/routes.py +++ b/examples/room_manager/routes.py @@ -1,4 +1,5 @@ from dataclasses import asdict +from typing import Literal, get_args from flask import Flask, abort, jsonify, request diff --git a/fishjam/api/_fishjam_client.py b/fishjam/api/_fishjam_client.py index 0387ff8..aa077a1 100644 --- a/fishjam/api/_fishjam_client.py +++ b/fishjam/api/_fishjam_client.py @@ -55,7 +55,9 @@ class RoomOptions: """Enforces video codec for each peer in the room""" webhook_url: str | None = None """URL where Fishjam notifications will be sent""" - room_type: Literal["conference", "audio_only", "livestream"] = "conference" + room_type: Literal[ + "conference", "audio_only", "livestream", "full_feature", "broadcaster" + ] = "conference" """The use-case of the room. If not provided, this defaults to conference.""" From 34d511f508b7703d488986ada59ecb1a2c75b1c8 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Tue, 10 Jun 2025 15:39:34 +0200 Subject: [PATCH 3/3] Fix lint warnings --- examples/room_manager/routes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/room_manager/routes.py b/examples/room_manager/routes.py index f8c965b..ce06645 100644 --- a/examples/room_manager/routes.py +++ b/examples/room_manager/routes.py @@ -1,5 +1,4 @@ from dataclasses import asdict -from typing import Literal, get_args from flask import Flask, abort, jsonify, request