@@ -12,12 +12,25 @@ class AudioConnectorWebSocket(BaseModel):
12
12
streams (list[str]): Stream IDs to include. If not provided, all streams are included.
13
13
headers (dict): The headers to send to your WebSocket server.
14
14
audio_rate (AudioSampleRate): The audio sample rate in Hertz.
15
+ bidirectional (bool): Whether the websocket is bidirectional.
15
16
"""
16
17
17
18
uri : str
18
19
streams : Optional [list [str ]] = None
19
20
headers : Optional [dict ] = None
20
21
audio_rate : Optional [AudioSampleRate ] = Field (None , serialization_alias = 'audioRate' )
22
+ bidirectional : Optional [bool ] = Field (
23
+ None , description = "Whether the websocket is bidirectional."
24
+ )
25
+
26
+ def model_dump (self , * args , ** kwargs ):
27
+ data = super ().model_dump (* args , ** kwargs )
28
+ if self .bidirectional is not True and 'bidirectional' in data :
29
+ del data ['bidirectional' ]
30
+
31
+ if 'audioRate' in data and isinstance (data ['audioRate' ], AudioSampleRate ):
32
+ data ['audioRate' ] = data ['audioRate' ].value
33
+ return data
21
34
22
35
23
36
class AudioConnectorOptions (BaseModel ):
@@ -33,6 +46,12 @@ class AudioConnectorOptions(BaseModel):
33
46
token : str
34
47
websocket : AudioConnectorWebSocket
35
48
49
+ def model_dump (self , * args , ** kwargs ):
50
+ data = super ().model_dump (* args , ** kwargs )
51
+ if isinstance (self .websocket , AudioConnectorWebSocket ):
52
+ data ['websocket' ] = self .websocket .model_dump (* args , ** kwargs )
53
+ return data
54
+
36
55
37
56
class AudioConnectorData (BaseModel ):
38
57
"""Class containing Audio Connector WebSocket ID and connection ID.
0 commit comments