11import aiohttp
2- from livekit .protocol import room as proto_room
3- from livekit .protocol import models as proto_models
2+ from livekit .protocol .room import (
3+ CreateRoomRequest ,
4+ ListRoomsRequest ,
5+ DeleteRoomRequest ,
6+ ListRoomsResponse ,
7+ DeleteRoomResponse ,
8+ ListParticipantsRequest ,
9+ ListParticipantsResponse ,
10+ RoomParticipantIdentity ,
11+ MuteRoomTrackRequest ,
12+ MuteRoomTrackResponse ,
13+ UpdateParticipantRequest ,
14+ UpdateSubscriptionsRequest ,
15+ SendDataRequest ,
16+ SendDataResponse ,
17+ UpdateRoomMetadataRequest ,
18+ RemoveParticipantResponse ,
19+ UpdateSubscriptionsResponse ,
20+ )
21+ from livekit .protocol .models import Room , ParticipantInfo
422from ._service import Service
523from .access_token import VideoGrants
624
@@ -13,124 +31,112 @@ def __init__(
1331 ):
1432 super ().__init__ (session , url , api_key , api_secret )
1533
16- async def create_room (
17- self , create : proto_room .CreateRoomRequest
18- ) -> proto_models .Room :
34+ async def create_room (self , create : CreateRoomRequest ) -> Room :
1935 return await self ._client .request (
2036 SVC ,
2137 "CreateRoom" ,
2238 create ,
2339 self ._auth_header (VideoGrants (room_create = True )),
24- proto_models . Room ,
40+ Room ,
2541 )
2642
27- async def list_rooms (
28- self , list : proto_room .ListRoomsRequest
29- ) -> proto_room .ListRoomsResponse :
43+ async def list_rooms (self , list : ListRoomsRequest ) -> ListRoomsResponse :
3044 return await self ._client .request (
3145 SVC ,
3246 "ListRooms" ,
3347 list ,
3448 self ._auth_header (VideoGrants (room_list = True )),
35- proto_room . ListRoomsResponse ,
49+ ListRoomsResponse ,
3650 )
3751
38- async def delete_room (
39- self , delete : proto_room .DeleteRoomRequest
40- ) -> proto_room .DeleteRoomResponse :
52+ async def delete_room (self , delete : DeleteRoomRequest ) -> DeleteRoomResponse :
4153 return await self ._client .request (
4254 SVC ,
4355 "DeleteRoom" ,
4456 delete ,
4557 self ._auth_header (VideoGrants (room_create = True )),
46- proto_room . DeleteRoomResponse ,
58+ DeleteRoomResponse ,
4759 )
4860
49- async def update_room_metadata (
50- self , update : proto_room .UpdateRoomMetadataRequest
51- ) -> proto_models .Room :
61+ async def update_room_metadata (self , update : UpdateRoomMetadataRequest ) -> Room :
5262 return await self ._client .request (
5363 SVC ,
5464 "UpdateRoomMetadata" ,
5565 update ,
5666 self ._auth_header (VideoGrants (room_admin = True , room = update .room )),
57- proto_models . Room ,
67+ Room ,
5868 )
5969
6070 async def list_participants (
61- self , list : proto_room . ListParticipantsRequest
62- ) -> proto_room . ListParticipantsResponse :
71+ self , list : ListParticipantsRequest
72+ ) -> ListParticipantsResponse :
6373 return await self ._client .request (
6474 SVC ,
6575 "ListParticipants" ,
6676 list ,
6777 self ._auth_header (VideoGrants (room_admin = True , room = list .room )),
68- proto_room . ListParticipantsResponse ,
78+ ListParticipantsResponse ,
6979 )
7080
71- async def get_participant (
72- self , get : proto_room .RoomParticipantIdentity
73- ) -> proto_models .ParticipantInfo :
81+ async def get_participant (self , get : RoomParticipantIdentity ) -> ParticipantInfo :
7482 return await self ._client .request (
7583 SVC ,
7684 "GetParticipant" ,
7785 get ,
7886 self ._auth_header (VideoGrants (room_admin = True , room = get .room )),
79- proto_models . ParticipantInfo ,
87+ ParticipantInfo ,
8088 )
8189
8290 async def remove_participant (
83- self , remove : proto_room . RoomParticipantIdentity
84- ) -> proto_room . RemoveParticipantResponse :
91+ self , remove : RoomParticipantIdentity
92+ ) -> RemoveParticipantResponse :
8593 return await self ._client .request (
8694 SVC ,
8795 "RemoveParticipant" ,
8896 remove ,
8997 self ._auth_header (VideoGrants (room_admin = True , room = remove .room )),
90- proto_room . RemoveParticipantResponse ,
98+ RemoveParticipantResponse ,
9199 )
92100
93101 async def mute_published_track (
94102 self ,
95- update : proto_room . MuteRoomTrackRequest ,
96- ) -> proto_room . MuteRoomTrackResponse :
103+ update : MuteRoomTrackRequest ,
104+ ) -> MuteRoomTrackResponse :
97105 return await self ._client .request (
98106 SVC ,
99107 "MutePublishedTrack" ,
100108 update ,
101109 self ._auth_header (VideoGrants (room_admin = True , room = update .room )),
102- proto_room . MuteRoomTrackResponse ,
110+ MuteRoomTrackResponse ,
103111 )
104112
105113 async def update_participant (
106- self , update : proto_room . UpdateParticipantRequest
107- ) -> proto_models . ParticipantInfo :
114+ self , update : UpdateParticipantRequest
115+ ) -> ParticipantInfo :
108116 return await self ._client .request (
109117 SVC ,
110118 "UpdateParticipant" ,
111119 update ,
112120 self ._auth_header (VideoGrants (room_admin = True , room = update .room )),
113- proto_models . ParticipantInfo ,
121+ ParticipantInfo ,
114122 )
115123
116124 async def update_subscriptions (
117- self , update : proto_room . UpdateSubscriptionsRequest
118- ) -> proto_room . UpdateSubscriptionsResponse :
125+ self , update : UpdateSubscriptionsRequest
126+ ) -> UpdateSubscriptionsResponse :
119127 return await self ._client .request (
120128 SVC ,
121129 "UpdateSubscriptions" ,
122130 update ,
123131 self ._auth_header (VideoGrants (room_admin = True , room = update .room )),
124- proto_room . UpdateSubscriptionsResponse ,
132+ UpdateSubscriptionsResponse ,
125133 )
126134
127- async def send_data (
128- self , send : proto_room .SendDataRequest
129- ) -> proto_room .SendDataResponse :
135+ async def send_data (self , send : SendDataRequest ) -> SendDataResponse :
130136 return await self ._client .request (
131137 SVC ,
132138 "SendData" ,
133139 send ,
134140 self ._auth_header (VideoGrants (room_admin = True , room = send .room )),
135- proto_room . SendDataResponse ,
141+ SendDataResponse ,
136142 )
0 commit comments