@simplito/privmx-webendpoint
Version:
PrivMX Web Endpoint library
91 lines (88 loc) • 3.34 kB
TypeScript
/*!
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 { BaseApi } from "./BaseApi";
import { ConnectionNative } from "../api/ConnectionNative";
import { PagingQuery, PagingList, Context, UserInfo, ConnectionEventType, ConnectionEventSelectorType } from "../Types";
import { BaseNative } from "../api/BaseNative";
import { UserVerifierInterface } from "./UserVerifierInterface";
export declare class Connection extends BaseApi {
private native;
/**
* //doc-gen:ignore
*/
apisRefs: {
[apiId: string]: {
_apiServicePtr: number;
};
};
/**
* //doc-gen:ignore
*/
nativeApisDeps: {
[apiId: string]: BaseNative;
};
constructor(native: ConnectionNative, ptr: number);
/**
* Gets the ID of the current connection.
*
* @returns {number} ID of the connection
*/
getConnectionId(): Promise<number>;
/**
* Gets a list of Contexts available for the user.
*
* @param pagingQuery with list query parameters
* @returns {PagingList<Context>} containing a list of Contexts
*/
listContexts(pagingQuery: PagingQuery): Promise<PagingList<Context>>;
/**
* Gets a list of users of given context.
*
* @param contextId ID of the Context
*
* @returns a list of the UserInfo objects
*/
listContextUsers(contextId: string, pagingQuery: PagingQuery): Promise<PagingList<UserInfo>>;
/**
* Subscribe for the Context events on the given subscription query.
*
* @param {string[]} subscriptionQueries list of queries
* @return list of subscriptionIds in matching order to subscriptionQueries
*/
subscribeFor(subscriptionQueries: string[]): Promise<string[]>;
/**
* Unsubscribe from events for the given subscriptionId.
* @param {string[]} subscriptionIds list of subscriptionId
*/
unsubscribeFrom(subscriptionIds: string[]): Promise<void>;
/**
* Generate subscription Query for the Context events.
* @param {EventType} eventType type of event which you listen for
* @param {EventSelectorType} selectorType scope on which you listen for events
* @param {string} selectorId ID of the selector
*/
buildSubscriptionQuery(eventType: ConnectionEventType, selectorType: ConnectionEventSelectorType, selectorId: string): Promise<string>;
/**
* Disconnects from the Platform backend.
*
*/
disconnect(): Promise<void>;
/**
* Sets user's custom verification callback.
*
* The feature allows the developer to set up a callback for user verification.
* A developer can implement an interface and pass the implementation to the function.
* Each time data is read from the container, a callback will be triggered, allowing the developer to validate the sender in an external service,
* e.g. Developer's Application Server or PKI Server.
* @param verifier an implementation of the UserVerifierInterface
*
*/
setUserVerifier(verifier: UserVerifierInterface): Promise<void>;
private freeApis;
}