|
1 | 1 | import { AbstractLiveClient } from "./AbstractLiveClient"; |
2 | 2 | import { LiveTranscriptionEvents } from "../lib/enums"; |
3 | | -import type { LiveSchema, LiveConfigOptions, DeepgramClientOptions } from "../lib/types"; |
4 | | -import { DeepgramError } from "../lib/errors"; |
| 3 | +import type { LiveSchema, LiveConfigOptions, DeepgramClientOptions, LiveTranscriptionEvent, LiveMetadataEvent, UtteranceEndEvent, SpeechStartedEvent } from "../lib/types"; |
| 4 | +import { DeepgramApiError, DeepgramError } from "../lib/errors"; |
5 | 5 |
|
6 | 6 | /** |
7 | 7 | * The `ListenLiveClient` class extends the `AbstractLiveClient` class and provides functionality for setting up and managing a WebSocket connection for live transcription. |
@@ -147,4 +147,17 @@ export class ListenLiveClient extends AbstractLiveClient { |
147 | 147 | } |
148 | 148 | } |
149 | 149 |
|
| 150 | +// eslint-disable-next-line |
| 151 | +export interface ListenLiveClient { |
| 152 | + on(eventName: `${LiveTranscriptionEvents.Transcript}`, listener: (data: LiveTranscriptionEvent) => void): this |
| 153 | + on(eventName: `${LiveTranscriptionEvents.Metadata}`, listener: (data: LiveMetadataEvent) => void): this |
| 154 | + on(eventName: `${LiveTranscriptionEvents.UtteranceEnd}`, listener: (data: UtteranceEndEvent) => void): this |
| 155 | + on(eventName: `${LiveTranscriptionEvents.SpeechStarted}`, listener: (data: SpeechStartedEvent) => void): this |
| 156 | + on(eventName: `${LiveTranscriptionEvents.Error}`, listener: (data: DeepgramApiError) => void): this |
| 157 | + on(eventName: `${LiveTranscriptionEvents.Close}`, listener: () => void): this |
| 158 | + on(eventName: `${LiveTranscriptionEvents.Open}`, listener: () => void): this |
| 159 | + on(eventName: `${LiveTranscriptionEvents.Unhandled}`, listener: (data: unknown) => void): this |
| 160 | +} |
| 161 | + |
| 162 | + |
150 | 163 | export { ListenLiveClient as LiveClient }; |
0 commit comments