@translated/lara
Version:
Official Lara SDK for JavaScript and Node.js
97 lines (96 loc) • 4.31 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 Glossary {
readonly id: string;
readonly name: string;
readonly ownerId: string;
readonly createdAt: Date;
readonly updatedAt: Date;
readonly sharedAt: Date;
/**
* 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 GlossaryImport {
readonly id: string;
readonly begin: number;
readonly end: number;
readonly channel: number;
readonly size: number;
readonly progress: number;
}
export interface GlossaryCounts {
unidirectional?: Record<string, number>;
multidirectional?: number;
}
export type GlossaryFileFormat = "csv/table-uni" | "csv/table-multi" | "tbx";
export interface GlossaryImportOptions {
contentType?: GlossaryFileFormat;
/** Whether the supplied file is already gzip-compressed. */
gzip?: boolean;
callbackUrl?: string;
}
export type GlossaryImportCallback = (glossaryImport: GlossaryImport) => void;
export interface GlossaryShareEntry {
readonly id: string;
readonly name: string;
readonly shareName: string;
readonly sharedAt: Date;
/** The permissions stored on this share. */
readonly permissionMask: PermissionMask;
}
export interface GlossaryShares {
readonly glossary: Glossary;
readonly account: GlossaryShareEntry | null;
readonly groups: GlossaryShareEntry[];
readonly users: GlossaryShareEntry[];
}
export declare class Glossaries {
private readonly client;
private readonly pollingInterval;
constructor(client: LaraClient);
/** @deprecated Use listPaginated() instead. */
list(): Promise<Glossary[]>;
/**
* 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<Glossary>>;
create(name: string): Promise<Glossary>;
get(id: string): Promise<Glossary | null>;
delete(id: string): Promise<Glossary>;
update(id: string, name: string): Promise<Glossary>;
getShares(id: string): Promise<GlossaryShares>;
addAccountShare(id: string, name?: string): Promise<Glossary>;
revokeAccountShare(id: string): Promise<Glossary>;
renameAccountShare(id: string, name: string): Promise<Glossary>;
addGroupShare(id: string, groupId: string, name?: string): Promise<Glossary>;
revokeGroupShare(id: string, groupId: string): Promise<Glossary>;
renameGroupShare(id: string, groupId: string, name: string): Promise<Glossary>;
importFile(id: string, file: MultiPartFile, options?: GlossaryImportOptions): Promise<GlossaryImport>;
/** @deprecated Use `importFile` instead. */
importCsv(id: string, csv: MultiPartFile, gzip?: boolean, callbackUrl?: string): Promise<GlossaryImport>;
/** @deprecated Use `importFile` instead. */
importCsv(id: string, csv: MultiPartFile, contentType: Exclude<GlossaryFileFormat, "tbx">, gzip?: boolean, callbackUrl?: string): Promise<GlossaryImport>;
getImportStatus(id: string): Promise<GlossaryImport>;
waitForImport(gImport: GlossaryImport, updateCallback?: GlossaryImportCallback, maxWaitTime?: number): Promise<GlossaryImport>;
counts(id: string): Promise<GlossaryCounts>;
export(id: string, contentType: GlossaryFileFormat, source?: string): Promise<string>;
exportAsync(id: string, callbackUrl: string, contentType: GlossaryFileFormat, source?: string): Promise<{
jobId: string;
}>;
addOrReplaceEntry(id: string, terms: {
language: string;
value: string;
}[], guid?: string): Promise<GlossaryImport>;
deleteEntry(id: string, term?: {
language: string;
value: string;
}, guid?: string): Promise<GlossaryImport>;
}