@translated/lara
Version:
Official Lara SDK for JavaScript and Node.js
81 lines (80 loc) • 3.97 kB
TypeScript
import type { CollectionResult } from "./collectionResult";
import type { LaraClient } from "./net/lara";
import type { MultiPartFile } from "./net/lara/client";
import type { PermissionMask } from "./permissions";
import type { ResourceQueryOptions } from "./resourceQuery";
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;
/**
* Effective combined mask in GET list and detail responses; the selected share's stored mask
* on the resource embedded in GET /shares responses. Omitted from non-GET responses.
*/
readonly permissionMask?: PermissionMask;
}
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 interface MemoryShareEntry {
readonly id: string;
readonly name: string;
readonly shareName: string;
readonly sharedAt: Date;
/** The permissions stored on this share. */
readonly permissionMask: PermissionMask;
}
export interface MemoryShares {
readonly memory: Memory;
readonly account: MemoryShareEntry | null;
readonly groups: MemoryShareEntry[];
readonly users: MemoryShareEntry[];
}
export declare class Memories {
private readonly client;
private readonly pollingInterval;
constructor(client: LaraClient);
/** @deprecated Use listPaginated() instead. */
list(): Promise<Memory[]>;
/**
* List resources with optional name filtering and pagination.
* Without options, returns the complete list of resources without pagination.
* Providing search, page, or size enables pagination; omitted page and size default to 1 and 20.
*/
listPaginated(options?: ResourceQueryOptions): Promise<CollectionResult<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[]>;
getShares(id: string): Promise<MemoryShares>;
addAccountShare(id: string, name?: string): Promise<Memory>;
revokeAccountShare(id: string): Promise<Memory>;
renameAccountShare(id: string, name: string): Promise<Memory>;
addGroupShare(id: string, groupId: string, name?: string): Promise<Memory>;
revokeGroupShare(id: string, groupId: string): Promise<Memory>;
renameGroupShare(id: string, groupId: string, name: string): Promise<Memory>;
importTmx(id: string, tmx: MultiPartFile): Promise<MemoryImport>;
importTmx(id: string, tmx: MultiPartFile, gzip: boolean): Promise<MemoryImport>;
importTmx(id: string, tmx: MultiPartFile, callbackUrl: string): Promise<MemoryImport>;
importTmx(id: string, tmx: MultiPartFile, gzip: boolean, callbackUrl: string): Promise<MemoryImport>;
exportAsync(id: string, callbackUrl: string, format?: "tmx" | "jtm"): Promise<{
jobId: string;
}>;
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>;
}