/*! 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 { ThreadApiNative } from "../api/ThreadApiNative"; import { PagingQuery, PagingList, UserWithPubKey, Thread, Message, ContainerPolicy, ThreadEventType, ThreadEventSelectorType } from "../Types"; export declare class ThreadApi extends BaseApi { protected native: ThreadApiNative; constructor(native: ThreadApiNative, ptr: number); /** * Creates a new Thread in given Context. * * @param {string} contextId ID of the Context to create the Thread in * @param {UserWithPubKey[]} users array of UserWithPubKey structs which indicates who will have access to the created Thread * @param {UserWithPubKey[]} managers array of UserWithPubKey structs which indicates who will have access (and management rights) to * the created Thread * @param {Uint8Array} publicMeta public (unencrypted) metadata * @param {Uint8Array} privateMeta private (encrypted) metadata * @param {ContainerPolicy} policies Thread's policies * @returns {string} ID of the created Thread */ createThread(contextId: string, users: UserWithPubKey[], managers: UserWithPubKey[], publicMeta: Uint8Array, privateMeta: Uint8Array, policies?: ContainerPolicy): Promise; /** * Updates an existing Thread. * * @param {string} threadId ID of the Thread to update * @param {UserWithPubKey[]} users array of UserWithPubKey structs which indicates who will have access to the created Thread * @param {UserWithPubKey[]} managers array of UserWithPubKey structs which indicates who will have access (and management rights) to * the created Thread * @param {Uint8Array} publicMeta public (unencrypted) metadata * @param {Uint8Array} privateMeta private (encrypted) metadata * @param {number} version current version of the updated Thread * @param {boolean} force force update (without checking version) * @param {boolean} forceGenerateNewKey force to regenerate a key for the Thread * @param {ContainerPolicy} policies Thread's policies */ updateThread(threadId: string, users: UserWithPubKey[], managers: UserWithPubKey[], publicMeta: Uint8Array, privateMeta: Uint8Array, version: number, force: boolean, forceGenerateNewKey: boolean, policies?: ContainerPolicy): Promise; /** * Deletes a Thread by given Thread ID. * * @param {string} threadId ID of the Thread to delete */ deleteThread(threadId: string): Promise; /** * Gets a Thread by given Thread ID. * * @param {string} threadId ID of Thread to get * @returns {Thread} containing info about the Thread */ getThread(threadId: string): Promise; /** * Gets a list of Threads in given Context. * * @param {string} contextId ID of the Context to get the Threads from * @param {PagingQuery} pagingQuery with list query parameters * @returns {PagingList} containing a list of Threads */ listThreads(contextId: string, pagingQuery: PagingQuery): Promise>; /** * Gets a message by given message ID. * * @param {string} messageId ID of the message to get * @returns {Message} containing the message */ getMessage(messageId: string): Promise; /** * Gets a list of messages from a Thread. * * @param {string} threadId ID of the Thread to list messages from * @param {PagingQuery} pagingQuery with list query parameters * @returns {PagingList} containing a list of messages */ listMessages(threadId: string, pagingQuery: PagingQuery): Promise>; /** * Sends a message in a Thread. * * @param {string} threadId ID of the Thread to send message to * @param {Uint8Array} publicMeta public message metadata * @param {Uint8Array} privateMeta private message metadata * @param {Uint8Array} data content of the message * @returns {string} ID of the new message */ sendMessage(threadId: string, publicMeta: Uint8Array, privateMeta: Uint8Array, data: Uint8Array): Promise; /** * Deletes a message by given message ID. * * @param {string} messageId ID of the message to delete */ deleteMessage(messageId: string): Promise; /** * Update message in a Thread. * * @param {string} messageId ID of the message to update * @param {Uint8Array} publicMeta public message metadata * @param {Uint8Array} privateMeta private message metadata * @param {Uint8Array} data content of the message */ updateMessage(messageId: string, publicMeta: Uint8Array, privateMeta: Uint8Array, data: Uint8Array): Promise; /** * Subscribe for the Thread events on the given subscription query. * * @param {string[]} subscriptionQueries list of queries * @return list of subscriptionIds in maching order to subscriptionQueries */ subscribeFor(subscriptionQueries: string[]): Promise; /** * Unsubscribe from events for the given subscriptionId. * @param {string[]} subscriptionIds list of subscriptionId */ unsubscribeFrom(subscriptionIds: string[]): Promise; /** * Generate subscription Query for the Thread 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: ThreadEventType, selectorType: ThreadEventSelectorType, selectorId: string): Promise; }