From 98df7690d739b3bb7e12ebe921fa6edb127400f0 Mon Sep 17 00:00:00 2001 From: Karol Konkol <56369082+Karolk99@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:05:35 +0100 Subject: [PATCH] Add recording component (#32) * Add recording component * Requested changes --- jellyfish/__init__.py | 8 ++ .../_openapi_client/api/health/healthcheck.py | 8 +- .../api/hls/subscribe_hls_to.py | 8 +- .../api/recording/delete_recording.py | 8 +- .../api/recording/get_recordings.py | 8 +- .../_openapi_client/api/room/add_component.py | 8 +- .../_openapi_client/api/room/add_peer.py | 8 +- .../_openapi_client/api/room/create_room.py | 8 +- .../api/room/delete_component.py | 8 +- .../_openapi_client/api/room/delete_peer.py | 8 +- .../_openapi_client/api/room/delete_room.py | 8 +- .../_openapi_client/api/room/get_all_rooms.py | 8 +- .../_openapi_client/api/room/get_room.py | 8 +- jellyfish/_openapi_client/api/sip/dial.py | 8 +- jellyfish/_openapi_client/api/sip/end_call.py | 8 +- jellyfish/_openapi_client/models/__init__.py | 6 ++ .../models/add_component_json_body.py | 34 +++++- .../models/component_details_response.py | 44 +++++++- .../models/component_options_recording.py | 84 +++++++++++++++ .../models/component_properties_recording.py | 60 +++++++++++ .../models/component_recording.py | 100 ++++++++++++++++++ jellyfish/_openapi_client/models/room.py | 42 +++++++- jellyfish/api/_room_api.py | 12 ++- protos | 2 +- tests/test_room_api.py | 21 ++++ 25 files changed, 452 insertions(+), 73 deletions(-) create mode 100644 jellyfish/_openapi_client/models/component_options_recording.py create mode 100644 jellyfish/_openapi_client/models/component_properties_recording.py create mode 100644 jellyfish/_openapi_client/models/component_recording.py diff --git a/jellyfish/__init__.py b/jellyfish/__init__.py index 57d9a3f..ada070a 100644 --- a/jellyfish/__init__.py +++ b/jellyfish/__init__.py @@ -14,14 +14,17 @@ ComponentOptionsFile, ComponentOptionsHLS, ComponentOptionsHLSSubscribeMode, + ComponentOptionsRecording, ComponentOptionsRTSP, ComponentOptionsSIP, ComponentPropertiesFile, ComponentPropertiesHLS, ComponentPropertiesHLSSubscribeMode, + ComponentPropertiesRecording, ComponentPropertiesRTSP, ComponentPropertiesSIP, ComponentPropertiesSIPSIPCredentials, + ComponentRecording, ComponentRTSP, ComponentSIP, Peer, @@ -30,6 +33,7 @@ Room, RoomConfig, RoomConfigVideoCodec, + S3Credentials, SIPCredentials, ) @@ -69,5 +73,9 @@ "events", "errors", "SIPCredentials", + "ComponentRecording", + "ComponentOptionsRecording", + "ComponentPropertiesRecording", + "S3Credentials", ] __docformat__ = "restructuredtext" diff --git a/jellyfish/_openapi_client/api/health/healthcheck.py b/jellyfish/_openapi_client/api/health/healthcheck.py index c66453b..d632277 100644 --- a/jellyfish/_openapi_client/api/health/healthcheck.py +++ b/jellyfish/_openapi_client/api/health/healthcheck.py @@ -47,7 +47,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, HealthcheckResponse]]: """Describes the health of Jellyfish @@ -70,7 +70,7 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, HealthcheckResponse]]: """Describes the health of Jellyfish @@ -89,7 +89,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, HealthcheckResponse]]: """Describes the health of Jellyfish @@ -110,7 +110,7 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, HealthcheckResponse]]: """Describes the health of Jellyfish diff --git a/jellyfish/_openapi_client/api/hls/subscribe_hls_to.py b/jellyfish/_openapi_client/api/hls/subscribe_hls_to.py index ea1b7e9..7836a6c 100644 --- a/jellyfish/_openapi_client/api/hls/subscribe_hls_to.py +++ b/jellyfish/_openapi_client/api/hls/subscribe_hls_to.py @@ -64,7 +64,7 @@ def _build_response( def sync_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: SubscriptionConfig, ) -> Response[Union[Any, Error]]: """Subscribe the HLS component to the tracks of peers or components @@ -96,7 +96,7 @@ def sync_detailed( def sync( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: SubscriptionConfig, ) -> Optional[Union[Any, Error]]: """Subscribe the HLS component to the tracks of peers or components @@ -123,7 +123,7 @@ def sync( async def asyncio_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: SubscriptionConfig, ) -> Response[Union[Any, Error]]: """Subscribe the HLS component to the tracks of peers or components @@ -153,7 +153,7 @@ async def asyncio_detailed( async def asyncio( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: SubscriptionConfig, ) -> Optional[Union[Any, Error]]: """Subscribe the HLS component to the tracks of peers or components diff --git a/jellyfish/_openapi_client/api/recording/delete_recording.py b/jellyfish/_openapi_client/api/recording/delete_recording.py index ea03030..22509ba 100644 --- a/jellyfish/_openapi_client/api/recording/delete_recording.py +++ b/jellyfish/_openapi_client/api/recording/delete_recording.py @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( recording_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Deletes the recording @@ -87,7 +87,7 @@ def sync_detailed( def sync( recording_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Deletes the recording @@ -111,7 +111,7 @@ def sync( async def asyncio_detailed( recording_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Deletes the recording @@ -138,7 +138,7 @@ async def asyncio_detailed( async def asyncio( recording_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Deletes the recording diff --git a/jellyfish/_openapi_client/api/recording/get_recordings.py b/jellyfish/_openapi_client/api/recording/get_recordings.py index 8174071..6464144 100644 --- a/jellyfish/_openapi_client/api/recording/get_recordings.py +++ b/jellyfish/_openapi_client/api/recording/get_recordings.py @@ -51,7 +51,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, RecordingListResponse]]: """Lists all available recordings @@ -74,7 +74,7 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, RecordingListResponse]]: """Lists all available recordings @@ -93,7 +93,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, RecordingListResponse]]: """Lists all available recordings @@ -114,7 +114,7 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, RecordingListResponse]]: """Lists all available recordings diff --git a/jellyfish/_openapi_client/api/room/add_component.py b/jellyfish/_openapi_client/api/room/add_component.py index 376628c..42aa23b 100644 --- a/jellyfish/_openapi_client/api/room/add_component.py +++ b/jellyfish/_openapi_client/api/room/add_component.py @@ -66,7 +66,7 @@ def _build_response( def sync_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddComponentJsonBody, ) -> Response[Union[ComponentDetailsResponse, Error]]: """Creates the component and adds it to the room @@ -98,7 +98,7 @@ def sync_detailed( def sync( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddComponentJsonBody, ) -> Optional[Union[ComponentDetailsResponse, Error]]: """Creates the component and adds it to the room @@ -125,7 +125,7 @@ def sync( async def asyncio_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddComponentJsonBody, ) -> Response[Union[ComponentDetailsResponse, Error]]: """Creates the component and adds it to the room @@ -155,7 +155,7 @@ async def asyncio_detailed( async def asyncio( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddComponentJsonBody, ) -> Optional[Union[ComponentDetailsResponse, Error]]: """Creates the component and adds it to the room diff --git a/jellyfish/_openapi_client/api/room/add_peer.py b/jellyfish/_openapi_client/api/room/add_peer.py index 82a3b18..68d82b0 100644 --- a/jellyfish/_openapi_client/api/room/add_peer.py +++ b/jellyfish/_openapi_client/api/room/add_peer.py @@ -70,7 +70,7 @@ def _build_response( def sync_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddPeerJsonBody, ) -> Response[Union[Error, PeerDetailsResponse]]: """Create peer @@ -102,7 +102,7 @@ def sync_detailed( def sync( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddPeerJsonBody, ) -> Optional[Union[Error, PeerDetailsResponse]]: """Create peer @@ -129,7 +129,7 @@ def sync( async def asyncio_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddPeerJsonBody, ) -> Response[Union[Error, PeerDetailsResponse]]: """Create peer @@ -159,7 +159,7 @@ async def asyncio_detailed( async def asyncio( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: AddPeerJsonBody, ) -> Optional[Union[Error, PeerDetailsResponse]]: """Create peer diff --git a/jellyfish/_openapi_client/api/room/create_room.py b/jellyfish/_openapi_client/api/room/create_room.py index c03f2a1..64ca51d 100644 --- a/jellyfish/_openapi_client/api/room/create_room.py +++ b/jellyfish/_openapi_client/api/room/create_room.py @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: RoomConfig, ) -> Response[Union[Error, RoomCreateDetailsResponse]]: """Creates a room @@ -87,7 +87,7 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: RoomConfig, ) -> Optional[Union[Error, RoomCreateDetailsResponse]]: """Creates a room @@ -111,7 +111,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: RoomConfig, ) -> Response[Union[Error, RoomCreateDetailsResponse]]: """Creates a room @@ -138,7 +138,7 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: RoomConfig, ) -> Optional[Union[Error, RoomCreateDetailsResponse]]: """Creates a room diff --git a/jellyfish/_openapi_client/api/room/delete_component.py b/jellyfish/_openapi_client/api/room/delete_component.py index c5fc775..1f3fa08 100644 --- a/jellyfish/_openapi_client/api/room/delete_component.py +++ b/jellyfish/_openapi_client/api/room/delete_component.py @@ -57,7 +57,7 @@ def sync_detailed( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Delete the component from the room @@ -89,7 +89,7 @@ def sync( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Delete the component from the room @@ -116,7 +116,7 @@ async def asyncio_detailed( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Delete the component from the room @@ -146,7 +146,7 @@ async def asyncio( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Delete the component from the room diff --git a/jellyfish/_openapi_client/api/room/delete_peer.py b/jellyfish/_openapi_client/api/room/delete_peer.py index e6045df..64101ab 100644 --- a/jellyfish/_openapi_client/api/room/delete_peer.py +++ b/jellyfish/_openapi_client/api/room/delete_peer.py @@ -57,7 +57,7 @@ def sync_detailed( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Delete peer @@ -89,7 +89,7 @@ def sync( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Delete peer @@ -116,7 +116,7 @@ async def asyncio_detailed( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Delete peer @@ -146,7 +146,7 @@ async def asyncio( room_id: str, id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Delete peer diff --git a/jellyfish/_openapi_client/api/room/delete_room.py b/jellyfish/_openapi_client/api/room/delete_room.py index 1ccbcd6..cacdc02 100644 --- a/jellyfish/_openapi_client/api/room/delete_room.py +++ b/jellyfish/_openapi_client/api/room/delete_room.py @@ -54,7 +54,7 @@ def _build_response( def sync_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Delete the room @@ -83,7 +83,7 @@ def sync_detailed( def sync( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Delete the room @@ -107,7 +107,7 @@ def sync( async def asyncio_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Delete the room @@ -134,7 +134,7 @@ async def asyncio_detailed( async def asyncio( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Delete the room diff --git a/jellyfish/_openapi_client/api/room/get_all_rooms.py b/jellyfish/_openapi_client/api/room/get_all_rooms.py index 149daf5..6342234 100644 --- a/jellyfish/_openapi_client/api/room/get_all_rooms.py +++ b/jellyfish/_openapi_client/api/room/get_all_rooms.py @@ -47,7 +47,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, RoomsListingResponse]]: """Show information about all rooms @@ -70,7 +70,7 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, RoomsListingResponse]]: """Show information about all rooms @@ -89,7 +89,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, RoomsListingResponse]]: """Show information about all rooms @@ -110,7 +110,7 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, RoomsListingResponse]]: """Show information about all rooms diff --git a/jellyfish/_openapi_client/api/room/get_room.py b/jellyfish/_openapi_client/api/room/get_room.py index f6a60ba..40de837 100644 --- a/jellyfish/_openapi_client/api/room/get_room.py +++ b/jellyfish/_openapi_client/api/room/get_room.py @@ -56,7 +56,7 @@ def _build_response( def sync_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, RoomDetailsResponse]]: """Shows information about the room @@ -85,7 +85,7 @@ def sync_detailed( def sync( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, RoomDetailsResponse]]: """Shows information about the room @@ -109,7 +109,7 @@ def sync( async def asyncio_detailed( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Error, RoomDetailsResponse]]: """Shows information about the room @@ -136,7 +136,7 @@ async def asyncio_detailed( async def asyncio( room_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Error, RoomDetailsResponse]]: """Shows information about the room diff --git a/jellyfish/_openapi_client/api/sip/dial.py b/jellyfish/_openapi_client/api/sip/dial.py index c7c9edb..f2196b8 100644 --- a/jellyfish/_openapi_client/api/sip/dial.py +++ b/jellyfish/_openapi_client/api/sip/dial.py @@ -67,7 +67,7 @@ def sync_detailed( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: DialConfig, ) -> Response[Union[Any, Error]]: """Make a call from the SIP component to the provided phone number @@ -102,7 +102,7 @@ def sync( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: DialConfig, ) -> Optional[Union[Any, Error]]: """Make a call from the SIP component to the provided phone number @@ -132,7 +132,7 @@ async def asyncio_detailed( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: DialConfig, ) -> Response[Union[Any, Error]]: """Make a call from the SIP component to the provided phone number @@ -165,7 +165,7 @@ async def asyncio( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, json_body: DialConfig, ) -> Optional[Union[Any, Error]]: """Make a call from the SIP component to the provided phone number diff --git a/jellyfish/_openapi_client/api/sip/end_call.py b/jellyfish/_openapi_client/api/sip/end_call.py index 772fc0f..5eb11ae 100644 --- a/jellyfish/_openapi_client/api/sip/end_call.py +++ b/jellyfish/_openapi_client/api/sip/end_call.py @@ -61,7 +61,7 @@ def sync_detailed( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Finish call made by SIP component @@ -93,7 +93,7 @@ def sync( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Finish call made by SIP component @@ -120,7 +120,7 @@ async def asyncio_detailed( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Response[Union[Any, Error]]: """Finish call made by SIP component @@ -150,7 +150,7 @@ async def asyncio( room_id: str, component_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, ) -> Optional[Union[Any, Error]]: """Finish call made by SIP component diff --git a/jellyfish/_openapi_client/models/__init__.py b/jellyfish/_openapi_client/models/__init__.py index de23bcb..8fabb51 100644 --- a/jellyfish/_openapi_client/models/__init__.py +++ b/jellyfish/_openapi_client/models/__init__.py @@ -8,17 +8,20 @@ from .component_options_file import ComponentOptionsFile from .component_options_hls import ComponentOptionsHLS from .component_options_hls_subscribe_mode import ComponentOptionsHLSSubscribeMode +from .component_options_recording import ComponentOptionsRecording from .component_options_rtsp import ComponentOptionsRTSP from .component_options_sip import ComponentOptionsSIP from .component_options_sipsip_credentials import ComponentOptionsSIPSIPCredentials from .component_properties_file import ComponentPropertiesFile from .component_properties_hls import ComponentPropertiesHLS from .component_properties_hls_subscribe_mode import ComponentPropertiesHLSSubscribeMode +from .component_properties_recording import ComponentPropertiesRecording from .component_properties_rtsp import ComponentPropertiesRTSP from .component_properties_sip import ComponentPropertiesSIP from .component_properties_sipsip_credentials import ( ComponentPropertiesSIPSIPCredentials, ) +from .component_recording import ComponentRecording from .component_rtsp import ComponentRTSP from .component_sip import ComponentSIP from .dial_config import DialConfig @@ -55,15 +58,18 @@ "ComponentOptionsFile", "ComponentOptionsHLS", "ComponentOptionsHLSSubscribeMode", + "ComponentOptionsRecording", "ComponentOptionsRTSP", "ComponentOptionsSIP", "ComponentOptionsSIPSIPCredentials", "ComponentPropertiesFile", "ComponentPropertiesHLS", "ComponentPropertiesHLSSubscribeMode", + "ComponentPropertiesRecording", "ComponentPropertiesRTSP", "ComponentPropertiesSIP", "ComponentPropertiesSIPSIPCredentials", + "ComponentRecording", "ComponentRTSP", "ComponentSIP", "DialConfig", diff --git a/jellyfish/_openapi_client/models/add_component_json_body.py b/jellyfish/_openapi_client/models/add_component_json_body.py index c3e0408..23697da 100644 --- a/jellyfish/_openapi_client/models/add_component_json_body.py +++ b/jellyfish/_openapi_client/models/add_component_json_body.py @@ -1,4 +1,12 @@ -from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union +from typing import ( + TYPE_CHECKING, + Any, + Dict, + List, + Type, + TypeVar, + Union, +) from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -8,6 +16,7 @@ if TYPE_CHECKING: from ..models.component_options_file import ComponentOptionsFile from ..models.component_options_hls import ComponentOptionsHLS + from ..models.component_options_recording import ComponentOptionsRecording from ..models.component_options_rtsp import ComponentOptionsRTSP from ..models.component_options_sip import ComponentOptionsSIP @@ -25,6 +34,7 @@ class AddComponentJsonBody: "ComponentOptionsFile", "ComponentOptionsHLS", "ComponentOptionsRTSP", + "ComponentOptionsRecording", "ComponentOptionsSIP", Unset, ] = UNSET @@ -37,6 +47,7 @@ def to_dict(self) -> Dict[str, Any]: from ..models.component_options_file import ComponentOptionsFile from ..models.component_options_hls import ComponentOptionsHLS from ..models.component_options_rtsp import ComponentOptionsRTSP + from ..models.component_options_sip import ComponentOptionsSIP type = self.type options: Union[Dict[str, Any], Unset] @@ -52,6 +63,9 @@ def to_dict(self) -> Dict[str, Any]: elif isinstance(self.options, ComponentOptionsFile): options = self.options.to_dict() + elif isinstance(self.options, ComponentOptionsSIP): + options = self.options.to_dict() + else: options = self.options.to_dict() @@ -72,6 +86,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: """@private""" from ..models.component_options_file import ComponentOptionsFile from ..models.component_options_hls import ComponentOptionsHLS + from ..models.component_options_recording import ComponentOptionsRecording from ..models.component_options_rtsp import ComponentOptionsRTSP from ..models.component_options_sip import ComponentOptionsSIP @@ -84,6 +99,7 @@ def _parse_options( "ComponentOptionsFile", "ComponentOptionsHLS", "ComponentOptionsRTSP", + "ComponentOptionsRecording", "ComponentOptionsSIP", Unset, ]: @@ -119,13 +135,23 @@ def _parse_options( return componentsschemas_component_options_type_2 except: # noqa: E722 pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_component_options_type_3 = ( + ComponentOptionsSIP.from_dict(data) + ) + + return componentsschemas_component_options_type_3 + except: # noqa: E722 + pass if not isinstance(data, dict): raise TypeError() - componentsschemas_component_options_type_3 = ComponentOptionsSIP.from_dict( - data + componentsschemas_component_options_type_4 = ( + ComponentOptionsRecording.from_dict(data) ) - return componentsschemas_component_options_type_3 + return componentsschemas_component_options_type_4 options = _parse_options(d.pop("options", UNSET)) diff --git a/jellyfish/_openapi_client/models/component_details_response.py b/jellyfish/_openapi_client/models/component_details_response.py index 91de1a9..b2d91b6 100644 --- a/jellyfish/_openapi_client/models/component_details_response.py +++ b/jellyfish/_openapi_client/models/component_details_response.py @@ -1,4 +1,12 @@ -from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union +from typing import ( + TYPE_CHECKING, + Any, + Dict, + List, + Type, + TypeVar, + Union, +) from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -6,6 +14,7 @@ if TYPE_CHECKING: from ..models.component_file import ComponentFile from ..models.component_hls import ComponentHLS + from ..models.component_recording import ComponentRecording from ..models.component_rtsp import ComponentRTSP from ..models.component_sip import ComponentSIP @@ -17,7 +26,13 @@ class ComponentDetailsResponse: """Response containing component details""" - data: Union["ComponentFile", "ComponentHLS", "ComponentRTSP", "ComponentSIP"] + data: Union[ + "ComponentFile", + "ComponentHLS", + "ComponentRTSP", + "ComponentRecording", + "ComponentSIP", + ] """Describes component""" additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) """@private""" @@ -27,6 +42,7 @@ def to_dict(self) -> Dict[str, Any]: from ..models.component_file import ComponentFile from ..models.component_hls import ComponentHLS from ..models.component_rtsp import ComponentRTSP + from ..models.component_sip import ComponentSIP data: Dict[str, Any] @@ -39,6 +55,9 @@ def to_dict(self) -> Dict[str, Any]: elif isinstance(self.data, ComponentFile): data = self.data.to_dict() + elif isinstance(self.data, ComponentSIP): + data = self.data.to_dict() + else: data = self.data.to_dict() @@ -57,6 +76,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: """@private""" from ..models.component_file import ComponentFile from ..models.component_hls import ComponentHLS + from ..models.component_recording import ComponentRecording from ..models.component_rtsp import ComponentRTSP from ..models.component_sip import ComponentSIP @@ -64,7 +84,13 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: def _parse_data( data: object, - ) -> Union["ComponentFile", "ComponentHLS", "ComponentRTSP", "ComponentSIP"]: + ) -> Union[ + "ComponentFile", + "ComponentHLS", + "ComponentRTSP", + "ComponentRecording", + "ComponentSIP", + ]: try: if not isinstance(data, dict): raise TypeError() @@ -89,11 +115,19 @@ def _parse_data( return componentsschemas_component_type_2 except: # noqa: E722 pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_component_type_3 = ComponentSIP.from_dict(data) + + return componentsschemas_component_type_3 + except: # noqa: E722 + pass if not isinstance(data, dict): raise TypeError() - componentsschemas_component_type_3 = ComponentSIP.from_dict(data) + componentsschemas_component_type_4 = ComponentRecording.from_dict(data) - return componentsschemas_component_type_3 + return componentsschemas_component_type_4 data = _parse_data(d.pop("data")) diff --git a/jellyfish/_openapi_client/models/component_options_recording.py b/jellyfish/_openapi_client/models/component_options_recording.py new file mode 100644 index 0000000..7e459e3 --- /dev/null +++ b/jellyfish/_openapi_client/models/component_options_recording.py @@ -0,0 +1,84 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.s3_credentials import S3Credentials + + +T = TypeVar("T", bound="ComponentOptionsRecording") + + +@_attrs_define +class ComponentOptionsRecording: + """Options specific to the Recording component""" + + credentials: Union[Unset, None, "S3Credentials"] = UNSET + """An AWS S3 credential that will be used to send HLS stream. The stream will only be uploaded if credentials are provided""" + path_prefix: Union[Unset, str] = "" + """Path prefix under which all recording are stored""" + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + """@private""" + + def to_dict(self) -> Dict[str, Any]: + """@private""" + credentials: Union[Unset, None, Dict[str, Any]] = UNSET + if not isinstance(self.credentials, Unset): + credentials = self.credentials.to_dict() if self.credentials else None + + path_prefix = self.path_prefix + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if credentials is not UNSET: + field_dict["credentials"] = credentials + if path_prefix is not UNSET: + field_dict["pathPrefix"] = path_prefix + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + """@private""" + from ..models.s3_credentials import S3Credentials + + d = src_dict.copy() + _credentials = d.pop("credentials", UNSET) + credentials: Union[Unset, None, S3Credentials] + if _credentials is None: + credentials = None + elif isinstance(_credentials, Unset): + credentials = UNSET + else: + credentials = S3Credentials.from_dict(_credentials) + + path_prefix = d.pop("pathPrefix", UNSET) + + component_options_recording = cls( + credentials=credentials, + path_prefix=path_prefix, + ) + + component_options_recording.additional_properties = d + return component_options_recording + + @property + def additional_keys(self) -> List[str]: + """@private""" + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/jellyfish/_openapi_client/models/component_properties_recording.py b/jellyfish/_openapi_client/models/component_properties_recording.py new file mode 100644 index 0000000..31d5434 --- /dev/null +++ b/jellyfish/_openapi_client/models/component_properties_recording.py @@ -0,0 +1,60 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ComponentPropertiesRecording") + + +@_attrs_define +class ComponentPropertiesRecording: + """Properties specific to the Recording component""" + + path_prefix: str + """Path prefix under which all recording are stored""" + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + """@private""" + + def to_dict(self) -> Dict[str, Any]: + """@private""" + path_prefix = self.path_prefix + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "pathPrefix": path_prefix, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + """@private""" + d = src_dict.copy() + path_prefix = d.pop("pathPrefix") + + component_properties_recording = cls( + path_prefix=path_prefix, + ) + + component_properties_recording.additional_properties = d + return component_properties_recording + + @property + def additional_keys(self) -> List[str]: + """@private""" + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/jellyfish/_openapi_client/models/component_recording.py b/jellyfish/_openapi_client/models/component_recording.py new file mode 100644 index 0000000..5c1fcab --- /dev/null +++ b/jellyfish/_openapi_client/models/component_recording.py @@ -0,0 +1,100 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.component_properties_recording import ComponentPropertiesRecording + from ..models.track import Track + + +T = TypeVar("T", bound="ComponentRecording") + + +@_attrs_define +class ComponentRecording: + """Describes the Recording component""" + + id: str + """Assigned component ID""" + properties: "ComponentPropertiesRecording" + """Properties specific to the Recording component""" + tracks: List["Track"] + """List of all component's tracks""" + type: str + """Component type""" + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + """@private""" + + def to_dict(self) -> Dict[str, Any]: + """@private""" + id = self.id + properties = self.properties.to_dict() + + tracks = [] + for tracks_item_data in self.tracks: + tracks_item = tracks_item_data.to_dict() + + tracks.append(tracks_item) + + type = self.type + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "properties": properties, + "tracks": tracks, + "type": type, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + """@private""" + from ..models.component_properties_recording import ComponentPropertiesRecording + from ..models.track import Track + + d = src_dict.copy() + id = d.pop("id") + + properties = ComponentPropertiesRecording.from_dict(d.pop("properties")) + + tracks = [] + _tracks = d.pop("tracks") + for tracks_item_data in _tracks: + tracks_item = Track.from_dict(tracks_item_data) + + tracks.append(tracks_item) + + type = d.pop("type") + + component_recording = cls( + id=id, + properties=properties, + tracks=tracks, + type=type, + ) + + component_recording.additional_properties = d + return component_recording + + @property + def additional_keys(self) -> List[str]: + """@private""" + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/jellyfish/_openapi_client/models/room.py b/jellyfish/_openapi_client/models/room.py index 4b73ad6..3597993 100644 --- a/jellyfish/_openapi_client/models/room.py +++ b/jellyfish/_openapi_client/models/room.py @@ -1,4 +1,12 @@ -from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union +from typing import ( + TYPE_CHECKING, + Any, + Dict, + List, + Type, + TypeVar, + Union, +) from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -6,6 +14,7 @@ if TYPE_CHECKING: from ..models.component_file import ComponentFile from ..models.component_hls import ComponentHLS + from ..models.component_recording import ComponentRecording from ..models.component_rtsp import ComponentRTSP from ..models.component_sip import ComponentSIP from ..models.peer import Peer @@ -20,7 +29,13 @@ class Room: """Description of the room state""" components: List[ - Union["ComponentFile", "ComponentHLS", "ComponentRTSP", "ComponentSIP"] + Union[ + "ComponentFile", + "ComponentHLS", + "ComponentRTSP", + "ComponentRecording", + "ComponentSIP", + ] ] """List of all components""" config: "RoomConfig" @@ -37,6 +52,7 @@ def to_dict(self) -> Dict[str, Any]: from ..models.component_file import ComponentFile from ..models.component_hls import ComponentHLS from ..models.component_rtsp import ComponentRTSP + from ..models.component_sip import ComponentSIP components = [] for components_item_data in self.components: @@ -51,6 +67,9 @@ def to_dict(self) -> Dict[str, Any]: elif isinstance(components_item_data, ComponentFile): components_item = components_item_data.to_dict() + elif isinstance(components_item_data, ComponentSIP): + components_item = components_item_data.to_dict() + else: components_item = components_item_data.to_dict() @@ -83,6 +102,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: """@private""" from ..models.component_file import ComponentFile from ..models.component_hls import ComponentHLS + from ..models.component_recording import ComponentRecording from ..models.component_rtsp import ComponentRTSP from ..models.component_sip import ComponentSIP from ..models.peer import Peer @@ -96,7 +116,11 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: def _parse_components_item( data: object, ) -> Union[ - "ComponentFile", "ComponentHLS", "ComponentRTSP", "ComponentSIP" + "ComponentFile", + "ComponentHLS", + "ComponentRTSP", + "ComponentRecording", + "ComponentSIP", ]: try: if not isinstance(data, dict): @@ -122,11 +146,19 @@ def _parse_components_item( return componentsschemas_component_type_2 except: # noqa: E722 pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_component_type_3 = ComponentSIP.from_dict(data) + + return componentsschemas_component_type_3 + except: # noqa: E722 + pass if not isinstance(data, dict): raise TypeError() - componentsschemas_component_type_3 = ComponentSIP.from_dict(data) + componentsschemas_component_type_4 = ComponentRecording.from_dict(data) - return componentsschemas_component_type_3 + return componentsschemas_component_type_4 components_item = _parse_components_item(components_item_data) diff --git a/jellyfish/api/_room_api.py b/jellyfish/api/_room_api.py index a2b7b9e..0a624f3 100644 --- a/jellyfish/api/_room_api.py +++ b/jellyfish/api/_room_api.py @@ -22,8 +22,10 @@ ComponentHLS, ComponentOptionsFile, ComponentOptionsHLS, + ComponentOptionsRecording, ComponentOptionsRTSP, ComponentOptionsSIP, + ComponentRecording, ComponentRTSP, ComponentSIP, DialConfig, @@ -133,15 +135,19 @@ def add_component( options: Union[ ComponentOptionsFile, ComponentOptionsHLS, + ComponentOptionsRecording, ComponentOptionsRTSP, ComponentOptionsSIP, ], - ) -> Union[ComponentFile, ComponentHLS, ComponentRTSP, ComponentSIP]: + ) -> Union[ + ComponentFile, ComponentHLS, ComponentRecording, ComponentRTSP, ComponentSIP + ]: """ Creates component in the room. Currently there are 4 different components: * File Component for which the options are `ComponentOptionsFile` * HLS Component which options are `ComponentOptionsHLS` + * Recording Component which options are `ComponentOptionsRecording` * RTSP Component which options are `ComponentOptionsRTSP` * SIP Component which options are `ComponentOptionsSIP` """ @@ -150,6 +156,8 @@ def add_component( component_type = "file" elif isinstance(options, ComponentOptionsHLS): component_type = "hls" + elif isinstance(options, ComponentOptionsRecording): + component_type = "recording" elif isinstance(options, ComponentOptionsRTSP): component_type = "rtsp" elif isinstance(options, ComponentOptionsSIP): @@ -157,7 +165,7 @@ def add_component( else: raise ValueError( "options must be ComponentOptionsFile, ComponentOptionsHLS," - "ComponentOptionsRTSP or ComponentOptionsSIP" + "ComponentOptionsRTSP, ComponentOptionsRecording or ComponentOptionsSIP" ) json_body = AddComponentJsonBody(type=component_type, options=options) diff --git a/protos b/protos index cb67f49..b9683a3 160000 --- a/protos +++ b/protos @@ -1 +1 @@ -Subproject commit cb67f49c47250daf9a97f1296ef7be8965ef4acf +Subproject commit b9683a3faec93b90b5f39e68cae387390fceba05 diff --git a/tests/test_room_api.py b/tests/test_room_api.py index 0bb4cff..18303ca 100644 --- a/tests/test_room_api.py +++ b/tests/test_room_api.py @@ -13,14 +13,17 @@ ComponentOptionsFile, ComponentOptionsHLS, ComponentOptionsHLSSubscribeMode, + ComponentOptionsRecording, ComponentOptionsRTSP, ComponentOptionsSIP, ComponentPropertiesFile, ComponentPropertiesHLS, ComponentPropertiesHLSSubscribeMode, + ComponentPropertiesRecording, ComponentPropertiesRTSP, ComponentPropertiesSIP, ComponentPropertiesSIPSIPCredentials, + ComponentRecording, ComponentRTSP, ComponentSIP, Peer, @@ -30,6 +33,7 @@ RoomApi, RoomConfig, RoomConfigVideoCodec, + S3Credentials, SIPCredentials, ) from jellyfish.errors import ( @@ -86,6 +90,17 @@ file_path=FILE_OPTIONS.file_path, framerate=30 ) +RECORDING_OPTIONS = ComponentOptionsRecording( + path_prefix="prefix", + credentials=S3Credentials( + bucket="bucket", + region="region", + secret_access_key="secret", + access_key_id="access", + ), +) +RECORDING_PROPERTIES = ComponentPropertiesRecording(path_prefix="prefix") + class TestAuthentication: def test_invalid_token(self): @@ -263,6 +278,12 @@ def test_with_options_sip(self, room_api): data = ComponentTestData(ComponentSIP, "sip", SIP_OPTIONS, SIP_PROPERTIES) self._test_component(room_api, data) + def test_with_options_recording(self, room_api): + data = ComponentTestData( + ComponentRecording, "recording", RECORDING_OPTIONS, RECORDING_PROPERTIES + ) + self._test_component(room_api, data) + @pytest.mark.file_component_sources def test_with_options_file(self, room_api): data = ComponentTestData(ComponentFile, "file", FILE_OPTIONS, FILE_PROPERTIES)