GenericInbox
Constructors
constructor
constructor(_inboxClient: InboxClient)
Name | Type | Description |
---|---|---|
_inboxClient | InboxClient |
Fields
inboxId
Gets ID of Inbox
get inboxId(): string
Methods
delete
Deletes Inbox
async delete()
Type | Description |
---|---|
Promise<void> |
info
Fetches info about Inbox.
async info()
Type | Description |
---|---|
Promise<Inbox> | information about Inbox |
listEntries
Gets a list of entries from current Inbox.
async listEntries(pageIndex: number, options: ListOptions)
Name | Type | Description |
---|---|---|
pageIndex | number | indicates from which page the list should start |
options | ListOptions | optional `options` object |
Type | Description |
---|---|
Promise<PagingList<InboxEntry>> | `PagingList<InboxEntry> |
on
Registers an event listener for Inbox entry-related events.
on(eventType: T, callback: (payload: Extract<InboxEntryCreatedEvent, {type: T;}> | Extract<InboxEntryDeletedEvent, {type: T;}>)=>void)
Name | Type | Description |
---|---|---|
eventType | T | type of event to listen for. |
callback | (payload: Extract<InboxEntryCreatedEvent, {type: T;}> | Extract<InboxEntryDeletedEvent, {type: T;}>)=>void | callback function to execute when the event occurs |
Type | Description |
---|---|
SubscribeForChannel<"inboxEntries"> & {
removeEventListener: ()=>void;
} | object containing the |
publicView
Fetches inbox public meta.
async publicView()
Type | Description |
---|---|
Promise<InboxPublicView> |
sendData
Sends data and optional files to an Inbox.
async sendData(entry: InboxEntryPayload)
Name | Type | Description |
---|---|---|
entry | InboxEntryPayload | Inbox entry object |
Type | Description |
---|---|
Promise<void> |
subscribeForEntryEvents
Subscribes to entry events on given Inbox: - `inboxNewEntry` - `inboxEntryDeleted`
async subscribeForEntryEvents()
Type | Description |
---|---|
Promise<SubscribeForChannel<"inboxEntries">> | <'inboxEntries'> `Promise<SubscribeForChannel<'inboxEntries'>> |
unsubscribeFromEntryEvents
Unsubscribes and removes all registered callbacks from events related to entries in this Inbox.
async unsubscribeFromEntryEvents()
Type | Description |
---|---|
Promise<void> | a promise that resolves with void |
update
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.
async update(updatedData: {
filesConfig: FilesConfig;
managers: UserWithPubKey[];
options: {
force: boolean;
forceGenerateNewKey: boolean;
};
privateMeta: Uint8Array;
publicMeta: Uint8Array;
users: UserWithPubKey[];
version: number;
})
Name | Type | Description |
---|---|---|
updatedData.filesConfig | FilesConfig | object to override default file configuration. Provide undefined if you want to leave the default configuration. |
updatedData.managers | UserWithPubKey[] | list of `UserWithPubKey` objects which indicates who will have access (and management rights) to the updated Inbox |
updatedData.options | {
force: boolean;
forceGenerateNewKey: boolean;
} | |
updatedData.privateMeta | Uint8Array | (encrypted) private Inbox metadata |
updatedData.publicMeta | Uint8Array | (unencrypted) public Inbox metadata |
updatedData.users | UserWithPubKey[] | list of `UserWithPubKey` objects which indicates who will have access to the updated Inbox |
updatedData.version | number | current version of the updated Inbox |
Type | Description |
---|---|
Promise<void> | a promise that resolves with void |