Skip to main content
reference

InboxApi

Swift wrapper for privmx.NativeInboxApiWrapper, providing methods to manage Inboxes and entries within PrivMX platform.

Static Methods

create(connection:threadApi:storeApi:)

Creates a new instance of `InboxApi</codeVoice> using a connection, <codeVoice>threadApi</codeVoice> and <codeVoice>

public static func create(
connection:inout Connection,
threadApi: inout ThreadApi,
storeApi: inout StoreApi
) throws -> InboxApi

NameTypeDescription
connectioninout ConnectionThe connection object to interact with PrivMX.
threadApiinout ThreadApiThe Thread API instance.
storeApiinout StoreApiThe Store API instance.

TypeDescription
InboxApi A new `InboxApi` instance.

Methods

createInbox(contextId:users:managers:publicMeta:privateMeta:filesConfig:)

Creates a new Inbox in the specified context.

public func createInbox(
contextId: std.string,
users: privmx.UserWithPubKeyVector,
managers: privmx.UserWithPubKeyVector,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
filesConfig: privmx.endpoint.inbox.FilesConfig?
) throws -> std.string

NameTypeDescription
contextIdstd.stringThe ID of the context where the Inbox should be created.
usersprivmx.UserWithPubKeyVectorA vector of users who will have access to the Inbox.
managersprivmx.UserWithPubKeyVectorA vector of users who will manage the Inbox.
publicMetaprivmx.endpoint.core.BufferPublic metadata that is not encrypted.
privateMetaprivmx.endpoint.core.BufferPrivate metadata that is encrypted.
filesConfigprivmx.endpoint.inbox.FilesConfig?An optional configuration for file storage.

TypeDescription
std.string The ID of the newly created Inbox as a `std.string`.

updateInbox(inboxId:users:managers:publicMeta:privateMeta:filesConfig:version:force:forceGenerateNewKey:)

Updates an existing Inbox with new metadata and configuration.

public func updateInbox(
inboxId: std.string,
users: privmx.UserWithPubKeyVector,
managers: privmx.UserWithPubKeyVector,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
filesConfig: privmx.endpoint.inbox.FilesConfig?,
version: Int64,
force: Bool,
forceGenerateNewKey: Bool
) throws -> Void

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox to be updated.
usersprivmx.UserWithPubKeyVectorA vector of users who will have access to the Inbox.
managersprivmx.UserWithPubKeyVectorA vector of users who will manage the Inbox.
publicMetaprivmx.endpoint.core.BufferUpdated public metadata for the Inbox.
privateMetaprivmx.endpoint.core.BufferUpdated private metadata for the Inbox.
filesConfigprivmx.endpoint.inbox.FilesConfig?An optional configuration for file storage.
versionInt64The current version of the Inbox for version control.
forceBoolWhether to force the update, ignoring version control.
forceGenerateNewKeyBoolWhether to force regeneration of a new key for the Inbox.

getInbox(inboxId:)

Retrieves detailed information about a specific Inbox.

public func getInbox(
inboxId: std.string
) throws -> privmx.endpoint.inbox.Inbox

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox to retrieve.

TypeDescription
privmx.endpoint.inbox.Inbox An `Inbox` instance containing Inbox details.

listInboxes(contextId:pagingQuery:)

Lists all Inboxes within a specified context.

public func listInboxes(
contextId: std.string,
pagingQuery: privmx.endpoint.core.PagingQuery
) throws -> privmx.InboxList

NameTypeDescription
contextIdstd.stringThe ID of the context from which to list Inboxes.
pagingQueryprivmx.endpoint.core.PagingQueryA query object to filter and paginate the results.

TypeDescription
privmx.InboxList An `InboxList` containing the list of Inboxes.

getInboxPublicView(inboxId:)

Retrieves the public view of a specific Inbox.

public func getInboxPublicView(
inboxId: std.string
) throws -> privmx.endpoint.inbox.InboxPublicView

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox to retrieve the public view for.

TypeDescription
privmx.endpoint.inbox.InboxPublicView An `InboxPublicView` containing the public view of the Inbox.

deleteInbox(inboxId:)

Deletes a specified Inbox.

public func deleteInbox(
inboxId: std.string
) throws -> Void

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox to delete.

prepareEntry(inboxId:data:inboxFileHandles:userPrivKey:)

Prepares a new entry to be sent to the Inbox. If the entry contains files, they must first be prepared using `createFileHandle()` and attached to the entry.

public func prepareEntry(
inboxId: std.string,
data: privmx.endpoint.core.Buffer,
inboxFileHandles: privmx.InboxFileHandleVector = [],
userPrivKey: std.string? = nil
) throws -> privmx.InboxHandle

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox to which the entry will be sent.
dataprivmx.endpoint.core.BufferThe data to be included in the entry.
inboxFileHandlesprivmx.InboxFileHandleVectorAn optional vector of file handles to be attached to the entry. By default, no files are attached.
userPrivKeystd.string?An optional private key of the user preparing the entry, if required.

TypeDescription
privmx.InboxHandle An `InboxHandle` representing the prepared entry, which should then be sent.

sendEntry(inboxHandle:)

Sends a previously prepared entry to the Inbox. This method finalizes the process by sending the entry to the specified Inbox.

public func sendEntry(
inboxHandle: privmx.InboxHandle
) throws -> Void

NameTypeDescription
inboxHandleprivmx.InboxHandleThe handle of the prepared entry to be sent.

readEntry(inboxEntryId:)

Retrieves an entry from a specific Inbox.

public func readEntry(
inboxEntryId: std.string
) throws -> privmx.endpoint.inbox.InboxEntry

NameTypeDescription
inboxEntryIdstd.stringThe ID of the entry to be retrieved.

TypeDescription
privmx.endpoint.inbox.InboxEntry An `InboxEntry` instance representing the entry.

listEntries(inboxId:pagingQuery:)

Lists entries within a specific Inbox.

public func listEntries(
inboxId: std.string,
pagingQuery: privmx.endpoint.core.PagingQuery
) throws -> privmx.InboxEntryList

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox from which to list entries.
pagingQueryprivmx.endpoint.core.PagingQueryA query object to filter and paginate the results.

TypeDescription
privmx.InboxEntryList An `InboxEntryList` containing the list of entries.

deleteEntry(inboxEntryId:)

Deletes a specified entry from an Inbox.

public func deleteEntry(
inboxEntryId: std.string
) throws -> Void

NameTypeDescription
inboxEntryIdstd.stringThe ID of the entry to delete.

createFileHandle(publicMeta:privateMeta:fileSize:)

Creates a new file handle for writing data to the Inbox.

public func createFileHandle(
publicMeta:privmx.endpoint.core.Buffer,
privateMeta:privmx.endpoint.core.Buffer,
fileSize: Int64
) throws -> privmx.InboxFileHandle

NameTypeDescription
publicMetaprivmx.endpoint.core.BufferPublic metadata for the file.
privateMetaprivmx.endpoint.core.BufferPrivate metadata for the file.
fileSizeInt64The size of the file in bytes.

TypeDescription
privmx.InboxFileHandle An `InboxFileHandle` for writing data to the file.

writeToFile(inboxHandle:inboxFileHandle:dataChunk:)

Writes a chunk of data to a file in the Inbox.

public func writeToFile(
inboxHandle: privmx.InboxHandle,
inboxFileHandle: privmx.InboxFileHandle,
dataChunk: privmx.endpoint.core.Buffer
) throws -> Void

NameTypeDescription
inboxHandleprivmx.InboxHandleThe handle of the Inbox containing the file.
inboxFileHandleprivmx.InboxFileHandleThe file handle to write data to.
dataChunkprivmx.endpoint.core.BufferThe chunk of data to write.

openFile(fileId:)

Opens a file for reading from the Inbox.

public func openFile(
fileId: std.string
) throws -> privmx.InboxFileHandle

NameTypeDescription
fileIdstd.stringThe ID of the file to open.

TypeDescription
privmx.InboxFileHandle An `InboxFileHandle` for reading from the file.

readFromFile(fileHandle:length:)

Reads data from an open file in the inbox.

public func readFromFile(
fileHandle: privmx.InboxFileHandle,
length: Int64
) throws -> privmx.endpoint.core.Buffer

NameTypeDescription
fileHandleprivmx.InboxFileHandleThe file handle to read from.
lengthInt64The number of bytes to read.

TypeDescription
privmx.endpoint.core.Buffer A buffer containing the read data.

seekInFile(fileHandle:position:)

Moves the read cursor in an open file.

public func seekInFile(
fileHandle: privmx.InboxFileHandle,
position: Int64
) throws -> Void

NameTypeDescription
fileHandleprivmx.InboxFileHandleThe file handle to move the cursor in.
positionInt64The new position of the cursor in bytes.

closeFile(fileHandle:)

Closes an open file in the Inbox.

public func closeFile(
fileHandle: privmx.InboxFileHandle
) throws -> std.string

NameTypeDescription
fileHandleprivmx.InboxFileHandleThe file handle to close.

TypeDescription
std.string The ID of the closed file as a `std.string`.

subscribeForInboxEvents()

Subscribes to Inbox-related events.

public func subscribeForInboxEvents(
) throws -> Void

unsubscribeFromInboxEvents()

Unsubscribes from Inbox-related events.

public func unsubscribeFromInboxEvents(
) throws -> Void

subscribeForEntryEvents(inboxId:)

Subscribes to entry-related events within a specific Inbox.

public func subscribeForEntryEvents(
inboxId: std.string
) throws -> Void

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox to subscribe to entry events for.

unsubscribeFromEntryEvents(inboxId:)

Unsubscribes from entry-related events within a specific Inbox.

public func unsubscribeFromEntryEvents(
inboxId: std.string
) throws -> Void

NameTypeDescription
inboxIdstd.stringThe ID of the Inbox to unsubscribe from entry events for.