UNPKG

@vot.js/core

Version:
69 lines 4.3 kB
import type { ClientSession, SessionModule } from "@vot.js/shared/types/secure"; import type { RequestLang, ResponseLang } from "@vot.js/shared/types/data"; import type { VOTOpts, FetchFunction, VOTSessions, URLSchema, ClientResponse } from "./types/client.js"; import type { VideoTranslationOpts, VideoTranslationResponse, VideoSubtitlesOpts, StreamPingOptions, StreamTranslationOpts, StreamTranslationResponse, VideoTranslationFailAudioResponse, AudioBufferObject, PartialAudioObject, GetSubtitlesResponse } from "./types/yandex.js"; import type { GetSubtitlesVOTOpts, VideoTranslationVOTOpts } from "./types/vot.js"; export declare class VOTJSError extends Error { data: unknown; constructor(message: string, data?: unknown); } export declare class MinimalClient { host: string; schema: URLSchema; fetch: FetchFunction; fetchOpts: Record<string, unknown>; sessions: VOTSessions; userAgent: string; headers: Record<string, string>; hostSchemaRe: RegExp; constructor({ host, fetchFn, fetchOpts, headers, }?: VOTOpts); request<T = ArrayBuffer>(path: string, body: Uint8Array, headers?: Record<string, string>, method?: string): Promise<ClientResponse<T>>; requestJSON<T = unknown>(path: string, body?: unknown, headers?: Record<string, string>, method?: string): Promise<ClientResponse<T>>; getOpts(body: unknown, headers?: Record<string, string>, method?: string): { method: string; headers: { [x: string]: string; }; body: unknown; }; getSession(module: SessionModule): Promise<ClientSession>; createSession(module: SessionModule): Promise<{ uuid: string; secretKey: string; expires: number; }>; } export default class VOTClient extends MinimalClient { hostVOT: string; schemaVOT: URLSchema; requestLang: RequestLang; responseLang: ResponseLang; paths: { videoTranslation: string; videoTranslationFailAudio: string; videoTranslationAudio: string; videoSubtitles: string; streamPing: string; streamTranslation: string; }; isCustomLink(url: string): boolean; headersVOT: Record<string, string>; constructor({ host, hostVOT, fetchFn, fetchOpts, requestLang, responseLang, headers, }?: VOTOpts); requestVOT<T = unknown>(path: string, body: NonNullable<any>, headers?: Record<string, string>): Promise<ClientResponse<T>>; protected translateVideoYAImpl({ videoData, requestLang, responseLang, translationHelp, headers, extraOpts, shouldSendFailedAudio, }: VideoTranslationOpts): Promise<VideoTranslationResponse>; protected translateVideoVOTImpl({ url, videoId, service, requestLang, responseLang, headers, }: VideoTranslationVOTOpts): Promise<VideoTranslationResponse>; protected requestVtransFailAudio(url: string): Promise<ClientResponse<VideoTranslationFailAudioResponse>>; requestVtransAudio(url: string, translationId: string, audioBuffer: AudioBufferObject, partialAudio?: PartialAudioObject, headers?: Record<string, string>): Promise<import("@vot.js/shared/protos").VideoTranslationAudioResponse>; translateVideo({ videoData, requestLang, responseLang, translationHelp, headers, extraOpts, shouldSendFailedAudio, }: VideoTranslationOpts): Promise<VideoTranslationResponse>; protected getSubtitlesYAImpl({ videoData, requestLang, headers, }: VideoSubtitlesOpts): Promise<GetSubtitlesResponse>; protected getSubtitlesVOTImpl({ url, videoId, service, headers, }: GetSubtitlesVOTOpts): Promise<GetSubtitlesResponse>; getSubtitles({ videoData, requestLang, headers, }: VideoSubtitlesOpts): Promise<GetSubtitlesResponse>; pingStream({ pingId, headers }: StreamPingOptions): Promise<boolean>; translateStream({ videoData, requestLang, responseLang, headers, }: StreamTranslationOpts): Promise<StreamTranslationResponse>; } export declare class VOTWorkerClient extends VOTClient { constructor(opts?: VOTOpts); request<T = ArrayBuffer>(path: string, body: Uint8Array, headers?: Record<string, string>, method?: string): Promise<ClientResponse<T>>; requestJSON<T = unknown>(path: string, body?: unknown, headers?: Record<string, string>, method?: string): Promise<ClientResponse<T>>; } //# sourceMappingURL=client.d.ts.map