Skip to content

Commit 3fcf348

Browse files
committed
Add sync methods to the api service clients
1 parent b05b3b1 commit 3fcf348

5 files changed

Lines changed: 410 additions & 0 deletions

File tree

livekit-api/livekit/api/egress_service.py

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,102 @@ async def stop_egress(
110110
self._auth_header(VideoGrants(room_record=True)),
111111
proto_egress.EgressInfo,
112112
)
113+
114+
def sync_start_room_composite_egress(
115+
self, start: proto_egress.RoomCompositeEgressRequest
116+
) -> proto_egress.EgressInfo:
117+
return self._client.sync_request(
118+
SVC,
119+
"StartRoomCompositeEgress",
120+
start,
121+
self._auth_header(VideoGrants(room_record=True)),
122+
proto_egress.EgressInfo,
123+
)
124+
125+
def sync_start_web_egress(
126+
self, start: proto_egress.WebEgressRequest
127+
) -> proto_egress.EgressInfo:
128+
return self._client.sync_request(
129+
SVC,
130+
"StartWebEgress",
131+
start,
132+
self._auth_header(VideoGrants(room_record=True)),
133+
proto_egress.EgressInfo,
134+
)
135+
136+
def sync_start_participant_egress(
137+
self, start: proto_egress.ParticipantEgressRequest
138+
) -> proto_egress.EgressInfo:
139+
return self._client.sync_request(
140+
SVC,
141+
"StartParticipantEgress",
142+
start,
143+
self._auth_header(VideoGrants(room_record=True)),
144+
proto_egress.EgressInfo,
145+
)
146+
147+
def sync_start_track_composite_egress(
148+
self, start: proto_egress.TrackCompositeEgressRequest
149+
) -> proto_egress.EgressInfo:
150+
return self._client.sync_request(
151+
SVC,
152+
"StartTrackCompositeEgress",
153+
start,
154+
self._auth_header(VideoGrants(room_record=True)),
155+
proto_egress.EgressInfo,
156+
)
157+
158+
def sync_start_track_egress(
159+
self, start: proto_egress.TrackEgressRequest
160+
) -> proto_egress.EgressInfo:
161+
return self._client.sync_request(
162+
SVC,
163+
"StartTrackEgress",
164+
start,
165+
self._auth_header(VideoGrants(room_record=True)),
166+
proto_egress.EgressInfo,
167+
)
168+
169+
def sync_update_layout(
170+
self, update: proto_egress.UpdateLayoutRequest
171+
) -> proto_egress.EgressInfo:
172+
return self._client.sync_request(
173+
SVC,
174+
"UpdateLayout",
175+
update,
176+
self._auth_header(VideoGrants(room_record=True)),
177+
proto_egress.EgressInfo,
178+
)
179+
180+
def sync_update_stream(
181+
self, update: proto_egress.UpdateStreamRequest
182+
) -> proto_egress.EgressInfo:
183+
return self._client.sync_request(
184+
SVC,
185+
"UpdateStream",
186+
update,
187+
self._auth_header(VideoGrants(room_record=True)),
188+
proto_egress.EgressInfo,
189+
)
190+
191+
def sync_list_egress(
192+
self, list: proto_egress.ListEgressRequest
193+
) -> proto_egress.ListEgressResponse:
194+
return self._client.sync_request(
195+
SVC,
196+
"ListEgress",
197+
list,
198+
self._auth_header(VideoGrants(room_record=True)),
199+
proto_egress.ListEgressResponse,
200+
)
201+
202+
def sync_stop_egress(
203+
self, stop: proto_egress.StopEgressRequest
204+
) -> proto_egress.EgressInfo:
205+
return self._client.sync_request(
206+
SVC,
207+
"StopEgress",
208+
stop,
209+
self._auth_header(VideoGrants(room_record=True)),
210+
proto_egress.EgressInfo,
211+
)

livekit-api/livekit/api/ingress_service.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,47 @@ async def delete_ingress(
5555
self._auth_header(VideoGrants(ingress_admin=True)),
5656
proto_ingress.IngressInfo,
5757
)
58+
59+
def sync_create_ingress(
60+
self, create: proto_ingress.CreateIngressRequest
61+
):
62+
return self._client.sync_request(
63+
SVC,
64+
"CreateIngress",
65+
create,
66+
self._auth_header(VideoGrants(ingress_admin=True)),
67+
proto_ingress.IngressInfo,
68+
)
69+
70+
def sync_update_ingress(
71+
self, update: proto_ingress.UpdateIngressRequest
72+
):
73+
return self._client.sync_request(
74+
SVC,
75+
"UpdateIngress",
76+
update,
77+
self._auth_header(VideoGrants(ingress_admin=True)),
78+
proto_ingress.IngressInfo,
79+
)
80+
81+
def sync_list_ingress(
82+
self, list: proto_ingress.ListIngressRequest
83+
):
84+
return self._client.sync_request(
85+
SVC,
86+
"ListIngress",
87+
list,
88+
self._auth_header(VideoGrants(ingress_admin=True)),
89+
proto_ingress.ListIngressResponse,
90+
)
91+
92+
def sync_delete_ingress(
93+
self, delete: proto_ingress.DeleteIngressRequest
94+
):
95+
return self._client.sync_request(
96+
SVC,
97+
"DeleteIngress",
98+
delete,
99+
self._auth_header(VideoGrants(ingress_admin=True)),
100+
proto_ingress.IngressInfo,
101+
)

livekit-api/livekit/api/room_service.py

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,125 @@ async def send_data(
134134
self._auth_header(VideoGrants(room_admin=True, room=send.room)),
135135
proto_room.SendDataResponse,
136136
)
137+
138+
def sync_create_room(
139+
self, create: proto_room.CreateRoomRequest
140+
) -> proto_models.Room:
141+
return self._client.sync_request(
142+
SVC,
143+
"CreateRoom",
144+
create,
145+
self._auth_header(VideoGrants(room_create=True)),
146+
proto_models.Room,
147+
)
148+
149+
def sync_delete_room(
150+
self, delete: proto_room.DeleteRoomRequest
151+
) -> proto_room.DeleteRoomResponse:
152+
return self._client.sync_request(
153+
SVC,
154+
"DeleteRoom",
155+
delete,
156+
self._auth_header(VideoGrants(room_create=True)),
157+
proto_room.DeleteRoomResponse,
158+
)
159+
160+
def sync_update_room_metadata(
161+
self, update: proto_room.UpdateRoomMetadataRequest
162+
) -> proto_models.Room:
163+
return self._client.sync_request(
164+
SVC,
165+
"UpdateRoomMetadata",
166+
update,
167+
self._auth_header(VideoGrants(room_admin=True, room=update.room)),
168+
proto_models.Room,
169+
)
170+
171+
def sync_remove_participant(
172+
self, remove: proto_room.RoomParticipantIdentity
173+
) -> proto_room.RemoveParticipantResponse:
174+
return self._client.sync_request(
175+
SVC,
176+
"RemoveParticipant",
177+
remove,
178+
self._auth_header(VideoGrants(room_admin=True, room=remove.room)),
179+
proto_room.RemoveParticipantResponse,
180+
)
181+
182+
def sync_mute_published_track(
183+
self,
184+
update: proto_room.MuteRoomTrackRequest,
185+
) -> proto_room.MuteRoomTrackResponse:
186+
return self._client.sync_request(
187+
SVC,
188+
"MutePublishedTrack",
189+
update,
190+
self._auth_header(VideoGrants(room_admin=True, room=update.room)),
191+
proto_room.MuteRoomTrackResponse,
192+
)
193+
194+
def sync_update_participant(
195+
self, update: proto_room.UpdateParticipantRequest
196+
) -> proto_models.ParticipantInfo:
197+
return self._client.sync_request(
198+
SVC,
199+
"UpdateParticipant",
200+
update,
201+
self._auth_header(VideoGrants(room_admin=True, room=update.room)),
202+
proto_models.ParticipantInfo,
203+
)
204+
205+
def sync_update_subscriptions(
206+
self, update: proto_room.UpdateSubscriptionsRequest
207+
) -> proto_room.UpdateSubscriptionsResponse:
208+
return self._client.sync_request(
209+
SVC,
210+
"UpdateSubscriptions",
211+
update,
212+
self._auth_header(VideoGrants(room_admin=True, room=update.room)),
213+
proto_room.UpdateSubscriptionsResponse,
214+
)
215+
216+
def sync_send_data(
217+
self, send: proto_room.SendDataRequest
218+
) -> proto_room.SendDataResponse:
219+
return self._client.sync_request(
220+
SVC,
221+
"SendData",
222+
send,
223+
self._auth_header(VideoGrants(room_admin=True, room=send.room)),
224+
proto_room.SendDataResponse,
225+
)
226+
227+
def sync_list_participants(
228+
self, list: proto_room.ListParticipantsRequest
229+
) -> proto_room.ListParticipantsResponse:
230+
return self._client.sync_request(
231+
SVC,
232+
"ListParticipants",
233+
list,
234+
self._auth_header(VideoGrants(room_admin=True, room=list.room)),
235+
proto_room.ListParticipantsResponse,
236+
)
237+
238+
def sync_get_participant(
239+
self, get: proto_room.RoomParticipantIdentity
240+
) -> proto_models.ParticipantInfo:
241+
return self._client.sync_request(
242+
SVC,
243+
"GetParticipant",
244+
get,
245+
self._auth_header(VideoGrants(room_admin=True, room=get.room)),
246+
proto_models.ParticipantInfo,
247+
)
248+
249+
def sync_list_rooms(
250+
self, list: proto_room.ListRoomsRequest
251+
) -> proto_room.ListRoomsResponse:
252+
return self._client.sync_request(
253+
SVC,
254+
"ListRooms",
255+
list,
256+
self._auth_header(VideoGrants(room_list=True)),
257+
proto_room.ListRoomsResponse,
258+
)

0 commit comments

Comments
 (0)