Skip to content

Commit bb54033

Browse files
committed
update 0.23.0 python docs
1 parent 79f3307 commit bb54033

1 file changed

Lines changed: 111 additions & 21 deletions

File tree

  • versioned_docs/version-0.23.0/api/server-python

versioned_docs/version-0.23.0/api/server-python/fishjam.md

Lines changed: 111 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ custom_edit_url: null
1818
```python
1919
class FishjamClient(Client):
2020
```
21-
Allows for managing rooms
21+
Allows for managing rooms.
2222

2323
### __init__
2424
```python
2525
def __init__(fishjam_id: str, management_token: str)
2626
```
27-
Create a FishjamClient instance, providing the fishjam id and management token.
27+
Create a FishjamClient instance.
28+
29+
Args:
30+
- fishjam_id: The unique identifier for the Fishjam instance.
31+
- management_token: The token used for authenticating management operations.
2832

2933
### create_peer
3034
```python
@@ -34,12 +38,16 @@ def create_peer(
3438
options: PeerOptions | None = None
3539
) -> tuple[Peer, str]
3640
```
37-
Creates peer in the room
41+
Creates a peer in the room.
3842

39-
Returns a tuple (`Peer`, `PeerToken`) - the token is needed by Peer
40-
to authenticate to Fishjam.
43+
Args:
44+
- room_id: The ID of the room where the peer will be created.
45+
- options: Configuration options for the peer. Defaults to None.
4146

42-
The possible options to pass for peer are `PeerOptions`.
47+
Returns:
48+
- A tuple containing:
49+
- Peer: The created peer object.
50+
- str: The peer token needed to authenticate to Fishjam.
4351

4452
### create_agent
4553
```python
@@ -49,7 +57,14 @@ def create_agent(
4957
options: AgentOptions | None = None
5058
)
5159
```
60+
Creates an agent in the room.
61+
62+
Args:
63+
- room_id: The ID of the room where the agent will be created.
64+
- options: Configuration options for the agent. Defaults to None.
5265

66+
Returns:
67+
- Agent: The created agent instance initialized with peer ID, room ID, token, and Fishjam URL.
5368

5469
### create_room
5570
```python
@@ -58,62 +73,112 @@ def create_room(
5873
options: RoomOptions | None = None
5974
) -> Room
6075
```
61-
Creates a new room
62-
Returns the created `Room`
76+
Creates a new room.
77+
78+
Args:
79+
- options: Configuration options for the room. Defaults to None.
80+
81+
Returns:
82+
- Room: The created Room object.
6383

6484
### get_all_rooms
6585
```python
6686
def get_all_rooms(self) -> list[Room]
6787
```
68-
Returns list of all rooms
88+
Returns list of all rooms.
89+
90+
Returns:
91+
- list[Room]: A list of all available Room objects.
6992

7093
### get_room
7194
```python
7295
def get_room(self, room_id: str) -> Room
7396
```
74-
Returns room with the given id
97+
Returns room with the given id.
98+
99+
Args:
100+
- room_id: The ID of the room to retrieve.
101+
102+
Returns:
103+
- Room: The Room object corresponding to the given ID.
75104

76105
### delete_peer
77106
```python
78107
def delete_peer(self, room_id: str, peer_id: str) -> None
79108
```
80-
Deletes peer
109+
Deletes a peer from a room.
110+
111+
Args:
112+
- room_id: The ID of the room the peer belongs to.
113+
- peer_id: The ID of the peer to delete.
81114

82115
### delete_room
83116
```python
84117
def delete_room(self, room_id: str) -> None
85118
```
86-
Deletes a room
119+
Deletes a room.
120+
121+
Args:
122+
- room_id: The ID of the room to delete.
87123

88124
### refresh_peer_token
89125
```python
90126
def refresh_peer_token(self, room_id: str, peer_id: str) -> str
91127
```
92-
Refreshes peer token
128+
Refreshes a peer token.
129+
130+
Args:
131+
- room_id: The ID of the room.
132+
- peer_id: The ID of the peer whose token needs refreshing.
133+
134+
Returns:
135+
- str: The new peer token.
93136

94137
### create_livestream_viewer_token
95138
```python
96139
def create_livestream_viewer_token(self, room_id: str) -> str
97140
```
98-
Generates viewer token for livestream rooms
141+
Generates a viewer token for livestream rooms.
142+
143+
Args:
144+
- room_id: The ID of the livestream room.
145+
146+
Returns:
147+
- str: The generated viewer token.
99148

100149
### create_livestream_streamer_token
101150
```python
102151
def create_livestream_streamer_token(self, room_id: str) -> str
103152
```
104-
Generates streamer token for livestream rooms
153+
Generates a streamer token for livestream rooms.
154+
155+
Args:
156+
- room_id: The ID of the livestream room.
157+
158+
Returns:
159+
- str: The generated streamer token.
105160

106161
### subscribe_peer
107162
```python
108163
def subscribe_peer(self, room_id: str, peer_id: str, target_peer_id: str)
109164
```
110-
Subscribe a peer to all tracks of another peer.
165+
Subscribes a peer to all tracks of another peer.
166+
167+
Args:
168+
- room_id: The ID of the room.
169+
- peer_id: The ID of the subscribing peer.
170+
- target_peer_id: The ID of the peer to subscribe to.
111171

112172
### subscribe_tracks
113173
```python
114174
def subscribe_tracks(self, room_id: str, peer_id: str, track_ids: list[str])
115175
```
116-
Subscribe a peer to specific tracks of another peer.
176+
Subscribes a peer to specific tracks of another peer.
177+
178+
Args:
179+
- room_id: The ID of the room.
180+
- peer_id: The ID of the subscribing peer.
181+
- track_ids: A list of track IDs to subscribe to.
117182

118183
#### Inherited Members
119184
* **Client**:
@@ -218,7 +283,12 @@ additional_keys: list[str]
218283
```python
219284
class PeerOptions:
220285
```
221-
Options specific to a WebRTC Peer
286+
Options specific to a WebRTC Peer.
287+
288+
Attributes:
289+
- enable_simulcast: Enables the peer to use simulcast.
290+
- metadata: Peer metadata.
291+
- subscribe_mode: Configuration of peer's subscribing policy.
222292

223293
### __init__
224294
```python
@@ -256,7 +326,14 @@ Configuration of peer's subscribing policy
256326
```python
257327
class RoomOptions:
258328
```
259-
Description of a room options
329+
Description of a room options.
330+
331+
Attributes:
332+
- max_peers: Maximum amount of peers allowed into the room.
333+
- video_codec: Enforces video codec for each peer in the room.
334+
- webhook_url: URL where Fishjam notifications will be sent.
335+
- room_type: The use-case of the room. If not provided, this defaults to conference.
336+
- public: True if livestream viewers can omit specifying a token.
260337

261338
### __init__
262339
```python
@@ -310,7 +387,11 @@ True if livestream viewers can omit specifying a token.
310387
```python
311388
class AgentOptions:
312389
```
313-
Options specific to a WebRTC Peer
390+
Options specific to a WebRTC Peer.
391+
392+
Attributes:
393+
- output: Configuration for the agent's output options.
394+
- subscribe_mode: Configuration of peer's subscribing policy.
314395

315396
### __init__
316397
```python
@@ -341,6 +422,10 @@ class AgentOutputOptions:
341422
```
342423
Options of the desired format of audio tracks going from Fishjam to the agent.
343424

425+
Attributes:
426+
- audio_format: The format of the audio stream (e.g., 'pcm16').
427+
- audio_sample_rate: The sample rate of the audio stream.
428+
344429
### __init__
345430
```python
346431
def __init__(
@@ -369,7 +454,12 @@ audio_sample_rate: Literal[16000, 24000] = 16000
369454
```python
370455
class Room:
371456
```
372-
Description of the room state
457+
Description of the room state.
458+
459+
Attributes:
460+
- config: Room configuration.
461+
- id: Room ID.
462+
- peers: List of all peers.
373463

374464
### __init__
375465
```python

0 commit comments

Comments
 (0)