UNPKG

swipelime-client-node

Version:

swipelime-client-node is the official swipelime Node.js client library

43 lines (42 loc) 1.62 kB
import { EventEmitter } from 'events'; import { ServiceHandler } from './ServiceHandler'; import { AuthParams, ClientOptions, ClientEventTypes, PingResponse, ServiceHandlerOptions } from './types'; import TaskEvent from './models/TaskEvent'; import TaskCommand from './models/TaskCommand'; export * from './types'; export { TaskEvent, TaskCommand, ServiceHandler }; export declare class Client { private readonly _authParams; private readonly _ddpClient; private readonly _eventEmitter; private _isInitialized; private _isLoggedIn; private _isConnected; private _serviceHandlers; readonly apiVersion = 1; readonly clientVersion = "0.4.2"; get isLoggedIn(): boolean; get isConnected(): boolean; get emitter(): EventEmitter<ClientEventTypes>; constructor(authParams: AuthParams, options?: ClientOptions); private init; callMethod: <T extends any[], R = unknown>(method: string, ...args: T) => Promise<R | undefined>; /** * Pings the server which will return 'pong' */ ping(): Promise<PingResponse | undefined>; /** * Returns the latency in milliseconds */ getLatency(): Promise<number>; /** * Returns an array of available tenant IDs that the client can access */ getAvailableTenantIds(): Promise<string[] | undefined>; /** * Adds a service handler for the specified tenant ID * Service handlers are used to interact with the API for a specific tenant */ addServiceHandler({ tenantId }: ServiceHandlerOptions): Promise<ServiceHandler>; getServiceHandlers(): ServiceHandler[]; }