Skip to content

Commit 1faadbd

Browse files
committed
docs updates
1 parent 2567636 commit 1faadbd

File tree

3 files changed

+72
-47
lines changed

3 files changed

+72
-47
lines changed

livekit-api/livekit/api/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""LiveKit API SDK"""
15+
"""LiveKit Server APIs for Python
16+
17+
See https://docs.livekit.io/home/server/ for docs and examples.
18+
"""
1619

1720
# flake8: noqa
1821
# re-export packages from protocol

livekit-api/livekit/api/livekit_api.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99

1010

1111
class LiveKitAPI:
12+
"""LiveKit Server API Client
13+
14+
Usage:
15+
16+
```python
17+
from livekit import api
18+
lkapi = api.LiveKitAPI()
19+
rooms = await lkapi.room.list_rooms(api.proto_room.ListRoomsRequest(names=['test-room']))
20+
```
21+
"""
22+
1223
def __init__(
1324
self,
1425
url: Optional[str] = None,
@@ -37,23 +48,28 @@ def __init__(
3748
)
3849

3950
@property
40-
def agent_dispatch(self):
51+
def agent_dispatch(self) -> AgentDispatchService:
52+
"""See :class:`AgentDispatchService`"""
4153
return self._agent_dispatch
4254

4355
@property
44-
def room(self):
56+
def room(self) -> RoomService:
57+
"""See :class:`RoomService`"""
4558
return self._room
4659

4760
@property
48-
def ingress(self):
61+
def ingress(self) -> IngressService:
62+
"""See :class:`IngressService`"""
4963
return self._ingress
5064

5165
@property
52-
def egress(self):
66+
def egress(self) -> EgressService:
67+
"""See :class:`EgressService`"""
5368
return self._egress
5469

5570
@property
56-
def sip(self):
71+
def sip(self) -> SipService:
72+
"""See: :class:`SipService`"""
5773
return self._sip
5874

5975
async def aclose(self):
Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
import 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
422
from ._service import Service
523
from .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

Comments
 (0)