import { EventDispatcher } from '../../EventDispatcher'; import { EndpointApiEvent, FilesConfig, Inbox, InboxEntry, ListOptions, PagingList, UserWithPubKey } from '../../types'; import { EventsByChannel, InboxEvents, SubscribeForChannel } from '../../types/events'; import { Endpoint } from '../Endpoint'; /** * Provides a wrapper for functions used to manage Inboxes in given Context. */ export declare class ContextInboxes { private _endpoint; private _eventDispatcher; constructor(_endpoint: Endpoint, _eventDispatcher: EventDispatcher); /** * Lists Inboxes the user has access to. * @param {object} query * @param {string} query.contextId indicates from which Context should Inboxes be fetched * @param {number} query.pageIndex indicates from which page the list should start * @param {ListOptions=} query.options optional {@link ListOptions options} object * @returns {Promise>} {@link PagingList `PagingList`} */ list(query: { contextId: string; pageIndex?: number; options?: ListOptions; }): Promise>; /** * Creates a new Inbox inside Context. * @param {object} newInbox * @param {string} newInbox.contextId - ID of the Context for the new Inbox * @param {UserWithPubKey[]} newInbox.users - list of {@link UserWithPubKey `UserWithPubKey`} objects which indicates who will have access to the created Inbox * @param {UserWithPubKey[]} newInbox.managers - list of {@link UserWithPubKey `UserWithPubKey`} objects which indicates who will have access (and management rights) to the created Inbox * @param {Uint8Array} newInbox.publicMeta - optional (unencrypted) public Inbox metadata * @param {Uint8Array} newInbox.privateMeta - optional (encrypted) private Inbox metadata * @param {FilesConfig} newInbox.filesConfig object to override default file configuration * @returns {Promise} Created Inbox ID */ new(newInbox: { contextId: string; users: UserWithPubKey[]; managers: UserWithPubKey[]; publicMeta?: Uint8Array; privateMeta?: Uint8Array; filesConfig?: FilesConfig; }): Promise; /** * Gets an Inbox entry based on its ID. * @param {string} entryId ID of the entry * @returns {Promise} {@link InboxEntry `Promise`} */ getEntry(entryId: string): Promise; /** * Deletes an Inbox entry based on its ID. * @param {string} entryId ID of the entry * @returns {Promise} {@link InboxEntry `Promise`} */ deleteEntry(entryId: string): Promise; /** * Gets the content of given file. * File is fetched in chunks and stored in memory. * @param {string} fileId - ID of the file to get the content from * @param {function(number): void} progressCallback optional callback function called after fetching each file chunk * @returns {Promise} content of the file */ getFileContents(fileId: string, progressCallback?: (progress: number) => void): Promise; /** * Downloads file from Inbox to your local environment. * * On platforms that support FileAPI 'showFilePicker' method it will fetch file in chunks. Otherwise, the file will be downloaded to memory first. * * @param {object} file * @param {string} file.fileId File ID * @param {string} file.fileName optional name that will be assigned to the file * @param {function(number): void} [file.progressCallback] optional callback function called after fetching each file chunk */ downloadFile(file: { fileId: string; fileName?: string; progressCallback?: (progress: number) => void; }): Promise; /** * Subscribes to events related to Inboxes: * - `inboxCreated` * - `inboxDeleted` * - `inboxStatsChanged` * - `inboxUpdated` * @returns {Promise>} {@link SubscribeForChannel<'inbox'> `Promise>`} */ subscribeForInboxEvents(): Promise>; /** * Unsubscribes and removes all registered callbacks for events related to Inboxes * @returns {Promise} */ unsubscribeFromInboxEvents(): Promise; /** * Registers an event listener for Inbox-related events. * * @template T * @param {T & EventsByChannel<'inbox'>} eventType - type of event to listen for * @param {function(Extract): void} callback - callback function to execute when the event occurs * @returns {SubscribeForChannel<'inbox'> & {removeEventListener: () => void}} object containing the `on` function for chaining and `removeEventListener` to unregister the event listener */ on>(eventType: T, callback: (payload: Extract) => void): SubscribeForChannel<'inbox'> & { removeEventListener: () => void; }; }