import { Disposable } from "../common/interfaces/disposable"; import { DBLiveContent } from "../content/content"; import { DBLiveKey } from "../key/key"; import { DBLiveKeyEventListener } from "../key/key.eventlistener"; import { DBLiveSocketManager } from "../socket/socket.manager"; import { DBLiveCallback } from "../types/dblive.callback"; export declare enum DBLiveClientStatus { notConnected = 0, connecting = 1, connected = 2 } export declare class DBLiveClient implements Disposable { private readonly appKey; readonly clientId: string; status: DBLiveClientStatus; private api?; private content?; private handlers; private readonly keys; private readonly lib; private readonly logger; private sockets?; constructor(appKey: string); connect(): Promise; dispose(): void; get(key: string, options?: DBLiveClientGetOptions): Promise; getAndListen(key: string, handler: (args: DBLiveClientGetAndListenHandlerArgs) => unknown): DBLiveKeyEventListener; getJson(key: string, options?: DBLiveClientGetOptions): Promise; getJsonAndListen(key: string, handler: (args: DBLiveClientGetJsonAndListenHandlerArgs) => unknown): DBLiveKeyEventListener; lock(key: string, options?: DBLiveClientLockOptions): Promise; lockAndSet(key: string, handler: (currentValue: T | undefined) => Promise | T, options?: DBLiveClientLockAndSetOptions): Promise; handleEvent(event: string, data?: T | undefined): this; key(key: string): DBLiveKey; off(id: string): this; on(event: string, handler: DBLiveCallback<{ [key: string]: unknown; }>): string; once(event: string, handler: DBLiveCallback<{ [key: string]: unknown; }>): string; reset(): Promise; set(key: string, value: T, options?: DBLiveClientSetOptions): Promise; private unlock; } export declare type DBLiveClientGetAndListenHandlerArgs = { value: string | undefined; customArgs?: Record; }; export declare type DBLiveClientGetJsonAndListenHandlerArgs = { value: T | undefined; customArgs?: Record; }; export declare type DBLiveClientGetOptions = { bypassCache?: boolean; }; export declare class DBLiveClientInternalLibrary { content: () => Promise; socket: () => Promise; constructor(content: () => Promise, socket: () => Promise); } export declare class DBLiveClientLock implements Disposable { readonly lockId: string; private readonly clientUnlock; isLocked: boolean; constructor(lockId: string, clientUnlock: (lockId: string) => Promise); dispose(): Promise; unlock(): Promise; } export declare type DBLiveClientLockOptions = { timeout?: number; }; export declare type DBLiveClientLockAndSetHandlerParams = { contentType?: string; value?: string; }; export declare type DBLiveClientLockAndSetOptions = { customArgs?: { [key: string]: string | number; }; timeout?: number; }; export declare type DBLiveClientSetOptions = { customArgs?: { [key: string]: string | number; }; lock?: DBLiveClientLock; };