UNPKG

@novo-learning/novo-sdk

Version:

SDK for the Novolanguage Speech Analysis API

49 lines (48 loc) 1.59 kB
import { ExerciseResult } from '../../../entities'; import { Exercise } from '../../../entities/exercise'; import { SetExerciseIdDto } from '../dto/exercise-id.dto'; import { SetConfigDto } from '../dto/set-config.dto'; import { EventBus } from '../event-bus'; export declare class SpeechApiConnection { private readonly url; private websocket?; readonly eventBus: EventBus; private connectionMonitor?; private messageQueue?; private lastUsedToken?; constructor(url: string); connect(token: string): Promise<void>; disconnect(): void; sendAudio(data: Blob | ArrayBuffer): Promise<void>; getResult(): Promise<ExerciseResult | undefined>; setExercise(exercise: Exercise): Promise<{ result: { success: boolean; error?: string; }; }>; setPrompt(prompt: string, confusion?: string | string[][], metadata?: { [key: string]: string | number | boolean; }): Promise<{ result: { success: boolean; error?: string; }; }>; setChoice(correctOptions: string[], incorrectOptions: string[], metadata?: { [key: string]: string | number | boolean; }, multiple?: boolean): Promise<{ result: { success: boolean; error?: string; }; }>; setExerciseId(config: SetExerciseIdDto): Promise<{ result: { success: boolean; error?: string; }; }>; updateAccessToken(accessToken: string): Promise<void>; setConfig(config: SetConfigDto): Promise<void>; }