UNPKG

@translated/lara

Version:

Official Lara SDK for JavaScript and Node.js

39 lines (38 loc) 1.85 kB
import type { LaraClient } from "./net"; import type { MultiPartFile } from "./net/client"; export interface Memory { readonly id: string; readonly createdAt: Date; readonly updatedAt: Date; readonly sharedAt: Date; readonly name: string; readonly externalId?: string; readonly secret?: string; readonly ownerId: string; readonly collaboratorsCount: number; } export interface MemoryImport { readonly id: string; readonly begin: number; readonly end: number; readonly channel: number; readonly size: number; readonly progress: number; } export type MemoryImportCallback = (memoryImport: MemoryImport) => void; export declare class Memories { private readonly client; private readonly pollingInterval; constructor(client: LaraClient); list(): Promise<Memory[]>; create(name: string, externalId?: string): Promise<Memory>; get(id: string): Promise<Memory | null>; delete(id: string): Promise<Memory>; update(id: string, name: string): Promise<Memory>; connect<T extends string | string[]>(ids: T): Promise<T extends string ? Memory : Memory[]>; importTmx(id: string, tmx: MultiPartFile, gzip?: boolean): Promise<MemoryImport>; addTranslation(id: string | string[], source: string, target: string, sentence: string, translation: string, tuid?: string, sentenceBefore?: string, sentenceAfter?: string, headers?: Record<string, string>): Promise<MemoryImport>; deleteTranslation(id: string | string[], source: string, target: string, sentence?: string, translation?: string, tuid?: string, sentenceBefore?: string, sentenceAfter?: string): Promise<MemoryImport>; getImportStatus(id: string): Promise<MemoryImport>; waitForImport(mImport: MemoryImport, updateCallback?: MemoryImportCallback, maxWaitTime?: number): Promise<MemoryImport>; }