44 lines
2.1 KiB
TypeScript
44 lines
2.1 KiB
TypeScript
|
|
import { type ClarizenNamespace } from "./endpoints.js";
|
||
|
|
import { EntityObjectsService } from "./objects.js";
|
||
|
|
import { type MetadataService } from "./metadata/service.js";
|
||
|
|
import { type NamespaceService, type OperationCall } from "./service.js";
|
||
|
|
import type { QueryParamValue } from "./http.js";
|
||
|
|
import type { EntityQueryParams, EntityQueryResult, JsonObject, LoginParams, LoginResult, ServerDefinition, SessionInfo } from "./types.js";
|
||
|
|
export interface ClarizenOptions {
|
||
|
|
baseUrl?: string;
|
||
|
|
apiToken?: string;
|
||
|
|
sessionId?: string;
|
||
|
|
}
|
||
|
|
export interface AuthenticationService {
|
||
|
|
getServerDefinition: (body?: JsonObject) => Promise<ServerDefinition>;
|
||
|
|
getSessionInfo: () => Promise<SessionInfo>;
|
||
|
|
login: (params: LoginParams) => Promise<LoginResult>;
|
||
|
|
logout: OperationCall;
|
||
|
|
}
|
||
|
|
export interface DataService {
|
||
|
|
entityQuery: (params: EntityQueryParams) => Promise<EntityQueryResult>;
|
||
|
|
[operation: string]: OperationCall | ((params: EntityQueryParams) => Promise<EntityQueryResult>);
|
||
|
|
}
|
||
|
|
export type { MetadataService } from "./metadata/service.js";
|
||
|
|
export declare class Clarizen {
|
||
|
|
private readonly http;
|
||
|
|
readonly authentication: AuthenticationService;
|
||
|
|
readonly applications: NamespaceService;
|
||
|
|
readonly bulk: NamespaceService;
|
||
|
|
readonly data: DataService;
|
||
|
|
readonly files: NamespaceService;
|
||
|
|
readonly metadata: MetadataService;
|
||
|
|
readonly utils: NamespaceService;
|
||
|
|
readonly objects: EntityObjectsService;
|
||
|
|
constructor(baseUrl: string, apiToken?: string);
|
||
|
|
constructor(options: ClarizenOptions);
|
||
|
|
get baseUrl(): string;
|
||
|
|
loginWithDiscovery(params: LoginParams): Promise<LoginResult>;
|
||
|
|
useSession(sessionId: string): void;
|
||
|
|
useApiKey(apiToken: string): void;
|
||
|
|
get sessionId(): string | undefined;
|
||
|
|
call<T = unknown>(namespace: ClarizenNamespace, operation: string, body?: Record<string, unknown>, query?: Record<string, QueryParamValue>): Promise<T>;
|
||
|
|
static createForLogin(baseUrl?: string): Clarizen;
|
||
|
|
static readonly namespaces: readonly ["applications", "authentication", "bulk", "data", "files", "metadata", "utils"];
|
||
|
|
}
|
||
|
|
//# sourceMappingURL=clarizen.d.ts.map
|