Skip to content

Commit e0aaf0f

Browse files
committed
override get
1 parent 7cf57a1 commit e0aaf0f

1 file changed

Lines changed: 32 additions & 19 deletions

File tree

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,54 @@
11
import typing
22

3-
from .speech_engine.client import SpeechEngineClient as AutogeneratedSpeechEngineClient
43
from .speech_engine.client import AsyncSpeechEngineClient as AutogeneratedAsyncSpeechEngineClient
4+
from .speech_engine.client import SpeechEngineClient as AutogeneratedSpeechEngineClient
55
from .speech_engine.resource import SpeechEngineResource
6+
from .core import RequestOptions
67

78

89
class SpeechEngineClient(AutogeneratedSpeechEngineClient):
910
"""Extends the generated SpeechEngineClient with WebSocket server integration."""
1011

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`).
1925
"""
26+
super().get(speech_engine_id, request_options=request_options)
2027
return SpeechEngineResource(
21-
engine_id=engine_id,
28+
engine_id=speech_engine_id,
2229
client_wrapper=self._client_wrapper,
2330
)
2431

2532

2633
class AsyncSpeechEngineClient(AutogeneratedAsyncSpeechEngineClient):
2734
"""Extends the generated AsyncSpeechEngineClient with WebSocket server integration."""
2835

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`).
3749
"""
50+
await super().get(speech_engine_id, request_options=request_options)
3851
return SpeechEngineResource(
39-
engine_id=engine_id,
52+
engine_id=speech_engine_id,
4053
client_wrapper=self._client_wrapper,
4154
)

0 commit comments

Comments
 (0)