UNPKG

@simplito/privmx-webendpoint

Version:

PrivMX Web Endpoint library

99 lines (96 loc) 3.36 kB
/*! PrivMX Web Endpoint. Copyright © 2024 Simplito sp. z o.o. This file is part of the PrivMX Platform (https://privmx.dev). This software is Licensed under the PrivMX Free License. See the License for the specific language governing permissions and limitations under the License. */ import { Connection } from "./Connection"; import { CryptoApi } from "./CryptoApi"; import { EventApi } from "./EventApi"; import { EventQueue } from "./EventQueue"; import { InboxApi } from "./InboxApi"; import { StoreApi } from "./StoreApi"; import { ThreadApi } from "./ThreadApi"; /** * Contains static factory methods - generators for Connection and APIs. */ export declare class EndpointFactory { private static api; private static eventQueueInstance; /** * Load the Endpoint's WASM assets and initialize the Endpoint library. * * @param {string} [assetsBasePath] base path/url to the Endpoint's WebAssembly assets (like: endpoint-wasm-module.js, driver-web-context.js and others) */ static setup(assetsBasePath?: string): Promise<void>; private static loadScript; /** * //doc-gen:ignore */ private static init; /** * Gets the EventQueue instance. * * @returns {EventQueue} instance of EventQueue */ static getEventQueue(): Promise<EventQueue>; /** * Connects to the platform backend. * * @param {string} userPrivKey user's private key * @param {string} solutionId ID of the Solution * @param {string} bridgeUrl the Bridge Server URL * @returns {Connection} instance of Connection */ static connect(userPrivKey: string, solutionId: string, bridgeUrl: string): Promise<Connection>; /** * Connects to the Platform backend as a guest user. * * @param {string} solutionId ID of the Solution * @param {string} bridgeUrl the Bridge Server URL * * @returns {Connection} instance of Connection */ static connectPublic(solutionId: string, bridgeUrl: string): Promise<Connection>; /** * Creates an instance of the Thread API. * * @param {Connection} connection instance of Connection * * @returns {ThreadApi} instance of ThreadApi */ static createThreadApi(connection: Connection): Promise<ThreadApi>; /** * Creates an instance of the Store API. * * @param {Connection} connection instance of Connection * * @returns {StoreApi} instance of StoreApi */ static createStoreApi(connection: Connection): Promise<StoreApi>; /** * Creates an instance of the Inbox API. * * @param {Connection} connection instance of Connection * @param {ThreadApi} threadApi instance of ThreadApi * @param {StoreApi} storeApi instance of StoreApi * @returns {InboxApi} instance of InboxApi */ static createInboxApi(connection: Connection, threadApi: ThreadApi, storeApi: StoreApi): Promise<InboxApi>; /** * Creates an instance of the Crypto API. * * @returns {CryptoApi} instance of CryptoApi */ static createCryptoApi(): Promise<CryptoApi>; /** * Creates an instance of 'EventApi'. * * @param connection instance of 'Connection' * * @returns {EventApi} instance of EventApi */ static createEventApi(connection: Connection): Promise<EventApi>; }