|
14 | 14 | from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
15 | 15 | from ...core.request_options import RequestOptions |
16 | 16 | from ...core.serialization import convert_and_respect_annotation_metadata |
| 17 | +from ...core.query_encoder import single_query_encoder |
17 | 18 | from ..types.connect_session_settings import ConnectSessionSettings |
18 | 19 | from .raw_client import AsyncRawChatClient, RawChatClient |
19 | 20 | from .socket_client import AsyncChatSocketClient, ChatSocketClient, ChatConnectOptions |
@@ -147,18 +148,10 @@ def connect( |
147 | 148 | query_params = query_params.add("verbose_transcription", verbose_transcription) |
148 | 149 | if api_key is not None: |
149 | 150 | query_params = query_params.add("api_key", api_key) |
150 | | - if ( |
151 | | - convert_and_respect_annotation_metadata( |
152 | | - object_=session_settings, annotation=ConnectSessionSettings, direction="write" |
153 | | - ) |
154 | | - is not None |
155 | | - ): |
156 | | - query_params = query_params.add( |
157 | | - "session_settings", |
158 | | - convert_and_respect_annotation_metadata( |
159 | | - object_=session_settings, annotation=ConnectSessionSettings, direction="write" |
160 | | - ), |
161 | | - ) |
| 151 | + if session_settings is not None: |
| 152 | + flattened_params = single_query_encoder("session_settings", session_settings) |
| 153 | + for param_key, param_value in flattened_params: |
| 154 | + query_params = query_params.add(param_key, str(param_value)) |
162 | 155 | ws_url = ws_url + f"?{query_params}" |
163 | 156 | headers = self._raw_client._client_wrapper.get_headers() |
164 | 157 | if request_options and "additional_headers" in request_options: |
@@ -287,18 +280,10 @@ async def connect( |
287 | 280 | query_params = query_params.add("verbose_transcription", verbose_transcription) |
288 | 281 | if api_key is not None: |
289 | 282 | query_params = query_params.add("api_key", api_key) |
290 | | - if ( |
291 | | - convert_and_respect_annotation_metadata( |
292 | | - object_=session_settings, annotation=ConnectSessionSettings, direction="write" |
293 | | - ) |
294 | | - is not None |
295 | | - ): |
296 | | - query_params = query_params.add( |
297 | | - "session_settings", |
298 | | - convert_and_respect_annotation_metadata( |
299 | | - object_=session_settings, annotation=ConnectSessionSettings, direction="write" |
300 | | - ), |
301 | | - ) |
| 283 | + if session_settings is not None: |
| 284 | + flattened_params = single_query_encoder("session_settings", session_settings) |
| 285 | + for param_key, param_value in flattened_params: |
| 286 | + query_params = query_params.add(param_key, str(param_value)) |
302 | 287 | ws_url = ws_url + f"?{query_params}" |
303 | 288 | headers = self._raw_client._client_wrapper.get_headers() |
304 | 289 | if request_options and "additional_headers" in request_options: |
|
0 commit comments