import { Connection, CryptoApi, EventQueue, InboxApi, StoreApi, ThreadApi, KvdbApi, EventApi } from "../service"; import { PublicConnection } from "./PublicConnection"; import { ConnectionEventsManager, CustomEventsManager, InboxEventsManager, KvdbEventsManager, StoreEventsManager, ThreadEventsManager, UserEventsManager } from "./managers"; import { EventManager } from "./events"; /** * @class PrivmxClient * @classdesc A client for interacting with the PrivMX Endpoint API. * @example * // Initialize the PrivMX client * await PrivmxClient.setup('/path/to/privmx/assets'); * * // Connect to the PrivMX bridge * const privateKey = 'your-private-key'; * const solutionId = 'your-solution-id'; * const contextId = 'your-context-id'; * const bridgeUrl = 'https://your-bridge-url.com'; * const client = await PrivmxClient.connect(privateKey, solutionId, bridgeUrl); * * // Get the Thread API and list threads * const threadApi = await client.getThreadApi(); * const threads = await threadApi.listThreads(contextId, { * skip: 0, * limit: 100, * sort: 'desc' * }) * * // Disconnect when done * await client.disconnect(); */ export declare class PrivmxClient { private connection; private static cryptoApi; private static eventQueue; private static isSetup; private static eventManager; private threadApi; private storeApi; private inboxApi; private kvdbApi; private eventApi; private connectionEventManager; private userEventManager; private threadEventManager; private storeEventManager; private inboxEventManager; private customEventsManager; private kvdbEventsManager; /** * @constructor * @param {Connection} connection - The connection object. */ private constructor(); /** * @description Sets up the PrivMX endpoint if it hasn't been set up yet. * @param {string} folderPath - The path to the folder where PrivMX assets are stored. * @returns {Promise} */ static setup(folderPath: string): Promise; private static checkSetup; /** * @description Gets the Crypto API. * @returns {Promise} */ static getCryptoApi(): Promise; /** * @description Gets the Event Queue. * @returns {Promise} */ static getEventQueue(): Promise; /** * @description Gets the Event Manager. * @returns {Promise} */ static getEventManager(): Promise; /** * @description Connects to the PrivMX bridge. * @param {string} privateKey user's private key * @param {string} solutionId ID of the Solution * @param {string} bridgeUrl the Bridge Server URL * @returns {Promise} * @throws {Error} If the connection to the bridge fails. */ static connect(privateKey: string, solutionId: string, bridgeUrl: string): Promise; /** * Connects to the Platform backend as a guest user. * * @param {string} solutionId ID of the Solution * @param {string} bridgeUrl the Bridge Server URL * * @returns {Promise} Promised instance of Connection */ static connectPublic(solutionId: string, bridgeUrl: string): Promise; /** * @description Gets the connection object. * @returns {Connection} * @throws {Error} If there is no active connection. */ getConnection(): Connection; /** * @description Gets the Thread API. * @returns {Promise} */ getThreadApi(): Promise; /** * @description Gets the Store API. * @returns {Promise} */ getStoreApi(): Promise; /** * @description Gets the Inbox API. * @returns {Promise} */ getInboxApi(): Promise; /** * @description Gets the Kvdb API. * @returns {Promise} */ getKvdbApi(): Promise; /** * @description Gets the Event API. * @returns {Promise} */ getEventApi(): Promise; /** * @description Gets the Connection Event Manager. * @returns {Promise} */ getConnectionEventManager(): Promise; /** * @description Gets the User Event Manager. * @returns {Promise} */ getUserEventsManager(): Promise; /** * @description Gets the Thread Event Manager. * @returns {Promise} */ getThreadEventManager(): Promise; /** * @description Gets the Store Event Manager. * @returns {Promise} */ getStoreEventManager(): Promise; /** * @description Gets the Inbox Event Manager. * @returns {Promise} */ getInboxEventManager(): Promise; /** * @description Gets the Custom Events Manager. * @returns {Promise} */ getCustomEventsManager(): Promise; getKvdbEventsManager(): Promise; /** * @description Disconnects from the PrivMX bridge. * @returns {Promise} */ disconnect(): Promise; }