Skip to content

Commit d0f144f

Browse files
Thomas Bakerclaude
andcommitted
Add overloaded convert signatures to SpeechToText wrapper
Narrow the return type of speechToText.convert() based on request parameters so users can access .text, .transcripts, or webhook fields without manual type narrowing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent defe433 commit d0f144f

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/wrapper/speechToText.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { SpeechToTextClient as GeneratedSpeechToText } from "../api/resources/speechToText/client/Client";
2+
import type { SpeechToTextClient } from "../api/resources/speechToText/client/Client";
3+
import type * as ElevenLabs from "../api";
4+
import type * as core from "../core";
25
import { ScribeRealtime } from "./realtime";
36

47
export class SpeechToText extends GeneratedSpeechToText {
@@ -10,5 +13,26 @@ export class SpeechToText extends GeneratedSpeechToText {
1013
}
1114
return this._realtime;
1215
}
13-
}
1416

17+
public convert(
18+
request: ElevenLabs.BodySpeechToTextV1SpeechToTextPost & { webhook: true },
19+
requestOptions?: SpeechToTextClient.RequestOptions,
20+
): core.HttpResponsePromise<ElevenLabs.SpeechToTextWebhookResponseModel>;
21+
22+
public convert(
23+
request: ElevenLabs.BodySpeechToTextV1SpeechToTextPost & { useMultiChannel: true },
24+
requestOptions?: SpeechToTextClient.RequestOptions,
25+
): core.HttpResponsePromise<ElevenLabs.MultichannelSpeechToTextResponseModel>;
26+
27+
public convert(
28+
request: ElevenLabs.BodySpeechToTextV1SpeechToTextPost,
29+
requestOptions?: SpeechToTextClient.RequestOptions,
30+
): core.HttpResponsePromise<ElevenLabs.SpeechToTextChunkResponseModel>;
31+
32+
public convert(
33+
request: ElevenLabs.BodySpeechToTextV1SpeechToTextPost,
34+
requestOptions?: SpeechToTextClient.RequestOptions,
35+
): core.HttpResponsePromise<ElevenLabs.SpeechToTextConvertResponse> {
36+
return super.convert(request, requestOptions);
37+
}
38+
}

0 commit comments

Comments
 (0)