import { EndpointApiEvent, FilesConfig, Inbox, InboxEntry, ListOptions, PagingList, UserWithPubKey } from '../../types'; import { EventsByChannel, InboxEntryEvents, SubscribeForChannel } from '../../types/events'; import { InboxEntryPayload } from '../../types/inboxes'; import { InboxClient } from '../InboxClient'; export declare class GenericInbox { private _inboxClient; constructor(_inboxClient: InboxClient); /** * Fetches inbox public meta. * @returns {Promise} */ publicView(): Promise; /** * Fetches info about Inbox. * @returns {Promise} information about Inbox */ info(): Promise; /** * Updates Inbox by overriding fields with new ones. * When updating, Bridge will check version number. Updates of Inbox with different * version number will be rejected. * Version number is incremented after every update. * * @param {object} updatedData * @param {UserWithPubKey[]} updatedData.users list of {@link UserWithPubKey `UserWithPubKey`} objects which indicates who will have access to the updated Inbox * @param {UserWithPubKey[]} updatedData.managers list of {@link UserWithPubKey `UserWithPubKey`} objects which indicates who will have access (and management rights) to the updated Inbox * @param {Uint8Array} updatedData.publicMeta (unencrypted) public Inbox metadata * @param {Uint8Array} updatedData.privateMeta (encrypted) private Inbox metadata * @param {FilesConfig | undefined} updatedData.filesConfig object to override default file configuration. Provide undefined if you want to leave the default configuration. * @param {number} updatedData.version current version of the updated Inbox * @param {boolean} [updatedData.options.force] - optional flag to generate a new key ID for the Inbox * @param {boolean} [updatedData.options.forceGenerateNewKey] - optional flag to allow new users to access old data * @returns {Promise} a promise that resolves with void */ update(updatedData: { users: UserWithPubKey[]; managers: UserWithPubKey[]; publicMeta?: Uint8Array; privateMeta?: Uint8Array; filesConfig?: FilesConfig; version: number; options?: { force?: boolean; forceGenerateNewKey?: boolean; }; }): Promise; /** * Deletes Inbox * @returns {Promise} */ delete(): Promise; /** * Sends data and optional files to an Inbox. * * @param {InboxEntryPayload} entry Inbox entry object * @returns {Promise} */ sendData(entry: InboxEntryPayload): Promise; /** * Gets a list of entries from current Inbox. * @param {number} pageIndex indicates from which page the list should start * @param {ListOptions} options optional {@link ListOptions `options`} object * @returns {Promise>} {@link PagingList `PagingList`} */ listEntries(pageIndex?: number, options?: ListOptions): Promise>; /** * Gets ID of Inbox */ get inboxId(): string; /** * Subscribes to entry events on given Inbox: * - `inboxNewEntry` * - `inboxEntryDeleted` * @returns {Promise>} {@link SubscribeForChannel<'inboxEntries'> `Promise>`} */ subscribeForEntryEvents(): Promise>; /** * Unsubscribes and removes all registered callbacks from events related to entries in this Inbox. * @returns {Promise} a promise that resolves with void */ unsubscribeFromEntryEvents(): Promise; /** * Registers an event listener for Inbox entry-related events. * * @template T * @param {T & EventsByChannel<'inboxEntries'>} eventType - type of event to listen for. * @param {function(Extract): void} callback - callback function to execute when the event occurs * @returns {Promise<{on: SubscribeForChannel<'inboxEntries'>, removeEventListener: function() void}>} object containing the `on` function for chaining and `removeEventListener` to unregister the event listener */ on>(eventType: T, callback: (payload: Extract) => void): SubscribeForChannel<'inboxEntries'> & { removeEventListener: () => void; }; }