
    h*                         S SK r S SKJr  S SKJrJrJrJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJr  S SKJrJr  SSKJr  SSKJr  Sr  " S	 S\5      rg)
    N)uuid4)CreateRoomRequestListRoomsRequestDeleteRoomRequestListRoomsResponseDeleteRoomResponseListParticipantsRequestListParticipantsResponseRoomParticipantIdentityMuteRoomTrackRequestMuteRoomTrackResponseUpdateParticipantRequestUpdateSubscriptionsRequestSendDataRequestSendDataResponseUpdateRoomMetadataRequestRemoveParticipantResponseUpdateSubscriptionsResponseForwardParticipantRequestForwardParticipantResponse)RoomParticipantInfo   )Service)VideoGrantsRoomServicec                   ,  ^  \ rS rSrSrS\R                  S\S\S\4U 4S jjrS\	S	\
4S
 jrS\S	\4S jrS\S	\4S jrS\S	\
4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	S4S jrS\S	\4S jr S\!S	\4S jr"S\#S	\$4S jr%S\&S	\'4S jr(Sr)U =r*$ )r       a@  Client for LiveKit RoomService API

Recommended way to use this service is via `livekit.api.LiveKitAPI`:

```python
from livekit import api
lkapi = api.LiveKitAPI()
room_service = lkapi.room
```

Also see https://docs.livekit.io/home/server/managing-rooms/ and https://docs.livekit.io/home/server/managing-participants/
sessionurlapi_key
api_secretc                 &   > [         TU ]  XX45        g )N)super__init__)selfr   r    r!   r"   	__class__s        J/var/www/html/env/lib/python3.13/site-packages/livekit/api/room_service.pyr%   RoomService.__init__.   s    w;    createreturnc                    #    U R                   R                  [        SUU R                  [	        SS95      [
        5      I Sh  vN $  N7f)ab  Creates a new room with specified configuration.

Args:
    create (CreateRoomRequest): arg containing:
        - name: str - Unique room name
        - empty_timeout: int - Seconds to keep room open if empty
        - max_participants: int - Max allowed participants
        - metadata: str - Custom room metadata
        - egress: RoomEgress - Egress configuration
        - min_playout_delay: int - Minimum playout delay in ms
        - max_playout_delay: int - Maximum playout delay in ms
        - sync_streams: bool - Enable A/V sync for playout delays >200ms

Returns:
    Room: The created room object

CreateRoomTroom_createN)_clientrequestSVC_auth_headerr   r   )r&   r+   s     r(   create_roomRoomService.create_room1   sG     ( \\))kd;<
 
 	
 
   AA
AA
listc                    #    U R                   R                  [        SUU R                  [	        SS95      [
        5      I Sh  vN $  N7f)zLists active rooms.

Args:
    list (ListRoomsRequest): arg containing:
        - names: list[str] - Optional list of room names to filter by

Returns:
    ListRoomsResponse:
        - rooms: list[Room] - List of active Room objects
	ListRoomsT)	room_listN)r1   r2   r3   r4   r   r   r&   r8   s     r(   
list_roomsRoomService.list_roomsM   sG      \\))kD9:
 
 	
 
r7   deletec                    #    U R                   R                  [        SUU R                  [	        SS95      [
        5      I Sh  vN $  N7f)zDeletes a room and disconnects all participants.

Args:
    delete (DeleteRoomRequest): arg containing:
        - room: str - Name of room to delete

Returns:
    DeleteRoomResponse: Empty response object

DeleteRoomTr/   N)r1   r2   r3   r4   r   r   )r&   r?   s     r(   delete_roomRoomService.delete_room`   sG      \\))kd;<
 
 	
 
r7   updatec                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN $  N7f)a  Updates a room's [metadata](https://docs.livekit.io/home/client/data/room-metadata/).

Args:
    update (UpdateRoomMetadataRequest): arg containing:
        - room: str - Name of room to update
        - metadata: str - New metadata to set

Returns:
    Room: Updated Room object
UpdateRoomMetadataT
room_adminroomN)r1   r2   r3   r4   r   rI   r   r&   rD   s     r(   update_room_metadata RoomService.update_room_metadatar   sM      \\)) kTLM
 
 	
 
   AAAAc                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN $  N7f)a  Lists all participants in a room.

Args:
    list (ListParticipantsRequest): arg containing:
        - room: str - Name of room to list participants from

Returns:
    ListParticipantsResponse:
        - participants: list[ParticipantInfo] - List of participant details
ListParticipantsTrG   N)r1   r2   r3   r4   r   rI   r
   r<   s     r(   list_participantsRoomService.list_participants   sM      \\))kT		JK$
 
 	
 
rM   getc                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN $  N7f)a  Gets details about a specific participant.

Args:
    get (RoomParticipantIdentity): arg containing:
        - room: str - Room name
        - identity: str - Participant identity to look up

Returns:
    ParticipantInfo:
        - sid: str - Participant session ID
        - identity: str - Participant identity
        - state: int - Connection state
        - tracks: list[TrackInfo] - Published tracks
        - metadata: str - Participant metadata
        - joined_at: int - Join timestamp
        - name: str - Display name
        - version: int - Protocol version
        - permission: ParticipantPermission - Granted permissions
        - region: str - Connected region
GetParticipantTrG   Nr1   r2   r3   r4   r   rI   r   )r&   rR   s     r(   get_participantRoomService.get_participant   sM     * \\))kTIJ
 
 	
 
rM   removec                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN $  N7f)zRemoves a participant from a room.

Args:
    remove (RoomParticipantIdentity): arg containing:
        - room: str - Room name
        - identity: str - Identity of participant to remove

Returns:
    RemoveParticipantResponse: Empty response object
RemoveParticipantTrG   N)r1   r2   r3   r4   r   rI   r   )r&   rX   s     r(   remove_participantRoomService.remove_participant   sM      \\))kTLM%
 
 	
 
rM   forwardNc                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN   g N7f)ab  Forwards a participant and their published tracks from one room to another.

This feature is only available for LiveKit Cloud/Private Cloud.

Args:
    forward (ForwardParticipantRequest): arg containing:
        - room: str - Room name
        - identity: str - identity of Participant to forward
        - destination_room: str - Destination room name
ForwardParticipantTrG   N)r1   r2   r3   r4   r   rI   r   )r&   r]   s     r(   forward_participantRoomService.forward_participant   sH      ll"" kTMN&
 	
 	
s   AAAAc                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN $  N7f)a  Mutes or unmutes a participant's published track.

Args:
    update (MuteRoomTrackRequest): arg containing:
        - room: str - Room name
        - identity: str - Participant identity
        - track_sid: str - Track session ID to mute
        - muted: bool - True to mute, False to unmute

Returns:
    MuteRoomTrackResponse containing:
        - track: TrackInfo - Updated track information
MutePublishedTrackTrG   N)r1   r2   r3   r4   r   rI   r   rJ   s     r(   mute_published_track RoomService.mute_published_track   sM     " \\)) kTLM!
 
 	
 
rM   c                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN $  N7f)a  Updates a participant's metadata or permissions.

Args:
    update (UpdateParticipantRequest): arg containing:
        - room: str - Room name
        - identity: str - Participant identity
        - metadata: str - New metadata
        - permission: ParticipantPermission - New permissions
        - name: str - New display name
        - attributes: dict[str, str] - Key-value attributes

Returns:
    ParticipantInfo: Updated participant information
UpdateParticipantTrG   NrU   rJ   s     r(   update_participantRoomService.update_participant   sM      \\))kTLM
 
 	
 
rM   c                    #    U R                   R                  [        SUU R                  [	        SUR
                  S95      [        5      I Sh  vN $  N7f)a  Updates a participant's track subscriptions.

Args:
    update (UpdateSubscriptionsRequest): arg containing:
        - room: str - Room name
        - identity: str - Participant identity
        - track_sids: list[str] - Track session IDs
        - subscribe: bool - True to subscribe, False to unsubscribe
        - participant_tracks: list[ParticipantTracks] - Participant track mappings

Returns:
    UpdateSubscriptionsResponse: Empty response object
UpdateSubscriptionsTrG   N)r1   r2   r3   r4   r   rI   r   rJ   s     r(   update_subscriptions RoomService.update_subscriptions  sM       \\))!kTLM'
 
 	
 
rM   sendc                    #    [        5       R                  Ul        U R                  R	                  [
        SUU R                  [        SUR                  S95      [        5      I Sh  vN $  N7f)a  Sends data to participants in a room.

Args:
    send (SendDataRequest): arg containing:
        - room: str - Room name
        - data: bytes - Data payload to send
        - kind: DataPacket.Kind - RELIABLE or LOSSY delivery
        - destination_identities: list[str] - Target participant identities
        - topic: str - Optional topic for the message

Returns:
    SendDataResponse: Empty response object
SendDataTrG   N)
r   bytesnoncer1   r2   r3   r4   r   rI   r   )r&   rn   s     r(   	send_dataRoomService.send_data&  sZ      W]]
\\))kT		JK
 
 	
 
s   A%A.'A,(A. )+__name__
__module____qualname____firstlineno____doc__aiohttpClientSessionstrr%   r   r   r5   r   r   r=   r   r   rB   r   rK   r	   r
   rP   r   r   rV   r   r[   r   r`   r   r   rd   r   rh   r   r   rl   r   r   rs   __static_attributes____classcell__)r'   s   @r(   r   r       s0   < 5 5 <C <# <[^ <
!
 

8
%5 
:K 
&
(9 
>P 
$
1J 
t 
&
,C 
H` 
&
)@ 
_ 
:
-
	"
*
1J 
t 
(
$
 

2
/G 
O 
.
0
	$
0
O 
8H 
 
r*   ) r{   uuidr   livekit.protocol.roomr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   livekit.protocol.modelsr   r   _servicer   access_tokenr   r3   r   ru   r*   r(   <module>r      sJ          * :  % \
' \
r*   