|
1 | 1 | import typing |
2 | 2 |
|
3 | | -from .speech_engine.client import SpeechEngineClient as AutogeneratedSpeechEngineClient |
4 | 3 | from .speech_engine.client import AsyncSpeechEngineClient as AutogeneratedAsyncSpeechEngineClient |
| 4 | +from .speech_engine.client import SpeechEngineClient as AutogeneratedSpeechEngineClient |
5 | 5 | from .speech_engine.resource import SpeechEngineResource |
| 6 | +from .core import RequestOptions |
6 | 7 |
|
7 | 8 |
|
8 | 9 | class SpeechEngineClient(AutogeneratedSpeechEngineClient): |
9 | 10 | """Extends the generated SpeechEngineClient with WebSocket server integration.""" |
10 | 11 |
|
11 | | - def resource(self, engine_id: str) -> SpeechEngineResource: |
12 | | - """Return a :class:`SpeechEngineResource` for WebSocket server setup. |
13 | | -
|
14 | | - Unlike :meth:`get` which fetches the full engine configuration from the |
15 | | - API, this method returns a lightweight resource bound to the given |
16 | | - *engine_id* that provides :meth:`~SpeechEngineResource.serve`, |
17 | | - :meth:`~SpeechEngineResource.create_session`, and |
18 | | - :meth:`~SpeechEngineResource.verify_request`. |
| 12 | + def get( # type: ignore[override] |
| 13 | + self, |
| 14 | + speech_engine_id: str, |
| 15 | + *, |
| 16 | + request_options: typing.Optional[RequestOptions] = None, |
| 17 | + ) -> SpeechEngineResource: |
| 18 | + """Retrieve a Speech Engine resource. |
| 19 | +
|
| 20 | + Makes an API call to validate the engine exists, then returns a |
| 21 | + :class:`SpeechEngineResource` with WebSocket integration methods |
| 22 | + (:meth:`~SpeechEngineResource.serve`, |
| 23 | + :meth:`~SpeechEngineResource.create_session`, |
| 24 | + :meth:`~SpeechEngineResource.verify_request`). |
19 | 25 | """ |
| 26 | + super().get(speech_engine_id, request_options=request_options) |
20 | 27 | return SpeechEngineResource( |
21 | | - engine_id=engine_id, |
| 28 | + engine_id=speech_engine_id, |
22 | 29 | client_wrapper=self._client_wrapper, |
23 | 30 | ) |
24 | 31 |
|
25 | 32 |
|
26 | 33 | class AsyncSpeechEngineClient(AutogeneratedAsyncSpeechEngineClient): |
27 | 34 | """Extends the generated AsyncSpeechEngineClient with WebSocket server integration.""" |
28 | 35 |
|
29 | | - def resource(self, engine_id: str) -> SpeechEngineResource: |
30 | | - """Return a :class:`SpeechEngineResource` for WebSocket server setup. |
31 | | -
|
32 | | - Unlike :meth:`get` which fetches the full engine configuration from the |
33 | | - API, this method returns a lightweight resource bound to the given |
34 | | - *engine_id* that provides :meth:`~SpeechEngineResource.serve`, |
35 | | - :meth:`~SpeechEngineResource.create_session`, and |
36 | | - :meth:`~SpeechEngineResource.verify_request`. |
| 36 | + async def get( # type: ignore[override] |
| 37 | + self, |
| 38 | + speech_engine_id: str, |
| 39 | + *, |
| 40 | + request_options: typing.Optional[RequestOptions] = None, |
| 41 | + ) -> SpeechEngineResource: |
| 42 | + """Retrieve a Speech Engine resource. |
| 43 | +
|
| 44 | + Makes an API call to validate the engine exists, then returns a |
| 45 | + :class:`SpeechEngineResource` with WebSocket integration methods |
| 46 | + (:meth:`~SpeechEngineResource.serve`, |
| 47 | + :meth:`~SpeechEngineResource.create_session`, |
| 48 | + :meth:`~SpeechEngineResource.verify_request`). |
37 | 49 | """ |
| 50 | + await super().get(speech_engine_id, request_options=request_options) |
38 | 51 | return SpeechEngineResource( |
39 | | - engine_id=engine_id, |
| 52 | + engine_id=speech_engine_id, |
40 | 53 | client_wrapper=self._client_wrapper, |
41 | 54 | ) |
0 commit comments