@translated/lara
Version:
Official Lara SDK for JavaScript and Node.js
50 lines (49 loc) • 1.8 kB
TypeScript
import type { LaraClient } from "./net/lara";
import type { MultiPartFile } from "./net/lara/client";
import type { LaraStream } from "./net/s3/laraStream";
import type { TranslationStyle } from "./translator";
export declare enum AudioStatus {
INITIALIZED = "initialized",// just been created
ANALYZING = "analyzing",// being analyzed for language detection and chars count
PAUSED = "paused",// paused after analysis, needs user confirm
READY = "ready",// ready to be translated
TRANSLATING = "translating",
TRANSLATED = "translated",
ERROR = "error"
}
export declare enum VoiceGender {
MALE = "male",
FEMALE = "female"
}
export type AudioOptions = {
adaptTo?: string[];
glossaries?: string[];
noTrace?: boolean;
style?: TranslationStyle;
voiceGender?: VoiceGender;
};
export type AudioUploadOptions = AudioOptions & {
contentLength?: number;
};
export interface Audio {
readonly id: string;
readonly status: AudioStatus;
readonly translatedSeconds?: number;
readonly totalSeconds?: number;
readonly source?: string;
readonly target: string;
readonly filename: string;
readonly createdAt: Date;
readonly updatedAt: Date;
readonly options?: AudioOptions;
readonly errorReason?: string;
}
export declare class AudioTranslator {
private readonly client;
private readonly s3Client;
constructor(client: LaraClient);
upload(file: MultiPartFile, filename: string, source: string | null, target: string, options?: AudioUploadOptions): Promise<Audio>;
status(id: string): Promise<Audio>;
download(id: string): Promise<LaraStream>;
translate(file: MultiPartFile, filename: string, source: string | null, target: string, options?: AudioUploadOptions): Promise<LaraStream>;
}