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
Name | Type | Description |
---|---|---|
connection | inout Connection | The connection object to interact with PrivMX. |
threadApi | inout ThreadApi | The Thread API instance. |
storeApi | inout StoreApi | The Store API instance. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
contextId | std.string | The ID of the context where the Inbox should be created. |
users | privmx.UserWithPubKeyVector | A vector of users who will have access to the Inbox. |
managers | privmx.UserWithPubKeyVector | A vector of users who will manage the Inbox. |
publicMeta | privmx.endpoint.core.Buffer | Public metadata that is not encrypted. |
privateMeta | privmx.endpoint.core.Buffer | Private metadata that is encrypted. |
filesConfig | privmx.endpoint.inbox.FilesConfig? | An optional configuration for file storage. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxId | std.string | The ID of the Inbox to be updated. |
users | privmx.UserWithPubKeyVector | A vector of users who will have access to the Inbox. |
managers | privmx.UserWithPubKeyVector | A vector of users who will manage the Inbox. |
publicMeta | privmx.endpoint.core.Buffer | Updated public metadata for the Inbox. |
privateMeta | privmx.endpoint.core.Buffer | Updated private metadata for the Inbox. |
filesConfig | privmx.endpoint.inbox.FilesConfig? | An optional configuration for file storage. |
version | Int64 | The current version of the Inbox for version control. |
force | Bool | Whether to force the update, ignoring version control. |
forceGenerateNewKey | Bool | Whether 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
Name | Type | Description |
---|---|---|
inboxId | std.string | The ID of the Inbox to retrieve. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
contextId | std.string | The ID of the context from which to list Inboxes. |
pagingQuery | privmx.endpoint.core.PagingQuery | A query object to filter and paginate the results. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxId | std.string | The ID of the Inbox to retrieve the public view for. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxId | std.string | The 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
Name | Type | Description |
---|---|---|
inboxId | std.string | The ID of the Inbox to which the entry will be sent. |
data | privmx.endpoint.core.Buffer | The data to be included in the entry. |
inboxFileHandles | privmx.InboxFileHandleVector | An optional vector of file handles to be attached to the entry. By default, no files are attached. |
userPrivKey | std.string? | An optional private key of the user preparing the entry, if required. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxHandle | privmx.InboxHandle | The 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
Name | Type | Description |
---|---|---|
inboxEntryId | std.string | The ID of the entry to be retrieved. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxId | std.string | The ID of the Inbox from which to list entries. |
pagingQuery | privmx.endpoint.core.PagingQuery | A query object to filter and paginate the results. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxEntryId | std.string | The 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
Name | Type | Description |
---|---|---|
publicMeta | privmx.endpoint.core.Buffer | Public metadata for the file. |
privateMeta | privmx.endpoint.core.Buffer | Private metadata for the file. |
fileSize | Int64 | The size of the file in bytes. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxHandle | privmx.InboxHandle | The handle of the Inbox containing the file. |
inboxFileHandle | privmx.InboxFileHandle | The file handle to write data to. |
dataChunk | privmx.endpoint.core.Buffer | The chunk of data to write. |
openFile(fileId:)
Opens a file for reading from the Inbox.
public func openFile(
fileId: std.string
) throws -> privmx.InboxFileHandle
Name | Type | Description |
---|---|---|
fileId | std.string | The ID of the file to open. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
fileHandle | privmx.InboxFileHandle | The file handle to read from. |
length | Int64 | The number of bytes to read. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
fileHandle | privmx.InboxFileHandle | The file handle to move the cursor in. |
position | Int64 | The 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
Name | Type | Description |
---|---|---|
fileHandle | privmx.InboxFileHandle | The file handle to close. |
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
inboxId | std.string | The 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
Name | Type | Description |
---|---|---|
inboxId | std.string | The ID of the Inbox to unsubscribe from entry events for. |