Skip to content

Commit 8448596

Browse files
committed
fmt
1 parent 08a2c0b commit 8448596

File tree

6 files changed

+135
-96
lines changed

6 files changed

+135
-96
lines changed

livekit-api/livekit/api/agent_dispatch_service.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import aiohttp
22
from typing import Optional
3-
from livekit.protocol.agent_dispatch import CreateAgentDispatchRequest, AgentDispatch, DeleteAgentDispatchRequest, ListAgentDispatchRequest, ListAgentDispatchResponse
3+
from livekit.protocol.agent_dispatch import (
4+
CreateAgentDispatchRequest,
5+
AgentDispatch,
6+
DeleteAgentDispatchRequest,
7+
ListAgentDispatchRequest,
8+
ListAgentDispatchResponse,
9+
)
410
from ._service import Service
511
from .access_token import VideoGrants
612

@@ -25,9 +31,7 @@ def __init__(
2531
):
2632
super().__init__(session, url, api_key, api_secret)
2733

28-
async def create_dispatch(
29-
self, req: CreateAgentDispatchRequest
30-
) -> AgentDispatch:
34+
async def create_dispatch(self, req: CreateAgentDispatchRequest) -> AgentDispatch:
3135
"""Create an explicit dispatch for an agent to join a room.
3236
3337
To use explicit dispatch, your agent must be registered with an `agentName`.
@@ -46,9 +50,7 @@ async def create_dispatch(
4650
AgentDispatch,
4751
)
4852

49-
async def delete_dispatch(
50-
self, dispatch_id: str, room_name: str
51-
) -> AgentDispatch:
53+
async def delete_dispatch(self, dispatch_id: str, room_name: str) -> AgentDispatch:
5254
"""Delete an explicit dispatch for an agent in a room.
5355
5456
Args:
@@ -69,9 +71,7 @@ async def delete_dispatch(
6971
AgentDispatch,
7072
)
7173

72-
async def list_dispatch(
73-
self, room_name: str
74-
) -> list[AgentDispatch]:
74+
async def list_dispatch(self, room_name: str) -> list[AgentDispatch]:
7575
"""List all agent dispatches in a room.
7676
7777
Args:
@@ -104,9 +104,7 @@ async def get_dispatch(
104104
res = await self._client.request(
105105
SVC,
106106
"ListDispatch",
107-
ListAgentDispatchRequest(
108-
dispatch_id=dispatch_id, room=room_name
109-
),
107+
ListAgentDispatchRequest(dispatch_id=dispatch_id, room=room_name),
110108
self._auth_header(VideoGrants(room_admin=True, room=room_name)),
111109
ListAgentDispatchResponse,
112110
)

livekit-api/livekit/api/egress_service.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
11
import aiohttp
2-
from livekit.protocol.egress import RoomCompositeEgressRequest, WebEgressRequest, ParticipantEgressRequest, TrackCompositeEgressRequest, TrackEgressRequest, UpdateLayoutRequest, UpdateStreamRequest, ListEgressRequest, StopEgressRequest, EgressInfo, ListEgressResponse
2+
from livekit.protocol.egress import (
3+
RoomCompositeEgressRequest,
4+
WebEgressRequest,
5+
ParticipantEgressRequest,
6+
TrackCompositeEgressRequest,
7+
TrackEgressRequest,
8+
UpdateLayoutRequest,
9+
UpdateStreamRequest,
10+
ListEgressRequest,
11+
StopEgressRequest,
12+
EgressInfo,
13+
ListEgressResponse,
14+
)
315
from ._service import Service
416
from .access_token import VideoGrants
517

618
SVC = "Egress"
719
"""@private"""
820

21+
922
class EgressService(Service):
1023
"""Client for LiveKit Egress Service API
11-
24+
1225
Recommended way to use this service is via `livekit.api.LiveKitAPI`:
13-
26+
1427
```python
1528
from livekit import api
1629
lkapi = api.LiveKitAPI()
1730
egress = lkapi.egress
1831
```
19-
32+
2033
Also see https://docs.livekit.io/home/egress/overview/
2134
"""
35+
2236
def __init__(
2337
self, session: aiohttp.ClientSession, url: str, api_key: str, api_secret: str
2438
):
@@ -35,9 +49,7 @@ async def start_room_composite_egress(
3549
EgressInfo,
3650
)
3751

38-
async def start_web_egress(
39-
self, start: WebEgressRequest
40-
) -> EgressInfo:
52+
async def start_web_egress(self, start: WebEgressRequest) -> EgressInfo:
4153
return await self._client.request(
4254
SVC,
4355
"StartWebEgress",
@@ -68,9 +80,7 @@ async def start_track_composite_egress(
6880
EgressInfo,
6981
)
7082

71-
async def start_track_egress(
72-
self, start: TrackEgressRequest
73-
) -> EgressInfo:
83+
async def start_track_egress(self, start: TrackEgressRequest) -> EgressInfo:
7484
return await self._client.request(
7585
SVC,
7686
"StartTrackEgress",
@@ -79,9 +89,7 @@ async def start_track_egress(
7989
EgressInfo,
8090
)
8191

82-
async def update_layout(
83-
self, update: UpdateLayoutRequest
84-
) -> EgressInfo:
92+
async def update_layout(self, update: UpdateLayoutRequest) -> EgressInfo:
8593
return await self._client.request(
8694
SVC,
8795
"UpdateLayout",
@@ -90,9 +98,7 @@ async def update_layout(
9098
EgressInfo,
9199
)
92100

93-
async def update_stream(
94-
self, update: UpdateStreamRequest
95-
) -> EgressInfo:
101+
async def update_stream(self, update: UpdateStreamRequest) -> EgressInfo:
96102
return await self._client.request(
97103
SVC,
98104
"UpdateStream",
@@ -101,9 +107,7 @@ async def update_stream(
101107
EgressInfo,
102108
)
103109

104-
async def list_egress(
105-
self, list: ListEgressRequest
106-
) -> ListEgressResponse:
110+
async def list_egress(self, list: ListEgressRequest) -> ListEgressResponse:
107111
return await self._client.request(
108112
SVC,
109113
"ListEgress",
@@ -112,9 +116,7 @@ async def list_egress(
112116
ListEgressResponse,
113117
)
114118

115-
async def stop_egress(
116-
self, stop: StopEgressRequest
117-
) -> EgressInfo:
119+
async def stop_egress(self, stop: StopEgressRequest) -> EgressInfo:
118120
return await self._client.request(
119121
SVC,
120122
"StopEgress",

livekit-api/livekit/api/ingress_service.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
import aiohttp
2-
from livekit.protocol.ingress import CreateIngressRequest, IngressInfo, UpdateIngressRequest, ListIngressRequest, DeleteIngressRequest, ListIngressResponse
2+
from livekit.protocol.ingress import (
3+
CreateIngressRequest,
4+
IngressInfo,
5+
UpdateIngressRequest,
6+
ListIngressRequest,
7+
DeleteIngressRequest,
8+
ListIngressResponse,
9+
)
310
from ._service import Service
411
from .access_token import VideoGrants
512

613
SVC = "Ingress"
714
"""@private"""
815

16+
917
class IngressService(Service):
1018
"""Client for LiveKit Ingress Service API
11-
19+
1220
Recommended way to use this service is via `livekit.api.LiveKitAPI`:
13-
21+
1422
```python
1523
from livekit import api
1624
lkapi = api.LiveKitAPI()
1725
ingress = lkapi.ingress
1826
```
19-
27+
2028
Also see https://docs.livekit.io/home/ingress/overview/
2129
"""
30+
2231
def __init__(
2332
self, session: aiohttp.ClientSession, url: str, api_key: str, api_secret: str
2433
):
2534
super().__init__(session, url, api_key, api_secret)
2635

27-
async def create_ingress(
28-
self, create: CreateIngressRequest
29-
) -> IngressInfo:
36+
async def create_ingress(self, create: CreateIngressRequest) -> IngressInfo:
3037
return await self._client.request(
3138
SVC,
3239
"CreateIngress",
@@ -35,9 +42,7 @@ async def create_ingress(
3542
IngressInfo,
3643
)
3744

38-
async def update_ingress(
39-
self, update: UpdateIngressRequest
40-
) -> IngressInfo:
45+
async def update_ingress(self, update: UpdateIngressRequest) -> IngressInfo:
4146
return await self._client.request(
4247
SVC,
4348
"UpdateIngress",
@@ -46,9 +51,7 @@ async def update_ingress(
4651
IngressInfo,
4752
)
4853

49-
async def list_ingress(
50-
self, list: ListIngressRequest
51-
) -> ListIngressResponse:
54+
async def list_ingress(self, list: ListIngressRequest) -> ListIngressResponse:
5255
return await self._client.request(
5356
SVC,
5457
"ListIngress",
@@ -57,9 +60,7 @@ async def list_ingress(
5760
ListIngressResponse,
5861
)
5962

60-
async def delete_ingress(
61-
self, delete: DeleteIngressRequest
62-
) -> IngressInfo:
63+
async def delete_ingress(self, delete: DeleteIngressRequest) -> IngressInfo:
6364
return await self._client.request(
6465
SVC,
6566
"DeleteIngress",

livekit-api/livekit/api/livekit_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class LiveKitAPI:
1212
"""LiveKit Server API Client
13-
13+
1414
This class is the main entrypoint, which exposes all services.
1515
1616
Usage:
@@ -31,7 +31,7 @@ def __init__(
3131
timeout: aiohttp.ClientTimeout = aiohttp.ClientTimeout(total=60), # 60 seconds
3232
):
3333
"""Create a new LiveKitAPI instance.
34-
34+
3535
Args:
3636
url: LiveKit server URL (read from `LIVEKIT_URL` environment variable if not provided)
3737
api_key: API key (read from `LIVEKIT_API_KEY` environment variable if not provided)
@@ -60,35 +60,35 @@ def __init__(
6060
@property
6161
def agent_dispatch(self) -> AgentDispatchService:
6262
"""Instance of the AgentDispatchService
63-
63+
6464
See `livekit.api.agent_dispatch_service.AgentDispatchService`"""
6565
return self._agent_dispatch
6666

6767
@property
6868
def room(self) -> RoomService:
6969
"""Instance of the RoomService
70-
70+
7171
See `livekit.api.room_service.RoomService`"""
7272
return self._room
7373

7474
@property
7575
def ingress(self) -> IngressService:
7676
"""Instance of the IngressService
77-
77+
7878
See `livekit.api.ingress_service.IngressService`"""
7979
return self._ingress
8080

8181
@property
8282
def egress(self) -> EgressService:
8383
"""Instance of the EgressService
84-
84+
8585
See `livekit.api.egress_service.EgressService`"""
8686
return self._egress
8787

8888
@property
8989
def sip(self) -> SipService:
9090
"""Instance of the SipService
91-
91+
9292
See `livekit.api.sip_service.SipService`"""
9393
return self._sip
9494

0 commit comments

Comments
 (0)