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>StoreApi
.
public static func create ( connection : inout Connection , threadApi : inout ThreadApi , storeApi : inout StoreApi ) throws - > InboxApi
Params 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.
Returns 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
Params 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.
Returns Type Description std.string
The ID of the newly created Inbox as a `std.string`.
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
Params 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
Params Name Type Description inboxId std.string
The ID of the Inbox to retrieve.
Returns 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
Params 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.
Returns 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
Params Name Type Description inboxId std.string
The ID of the Inbox to retrieve the public view for.
Returns 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
Params 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
Params 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.
Returns 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
Params 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
Params Name Type Description inboxEntryId std.string
The ID of the entry to be retrieved.
Returns 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
Params 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.
Returns 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
Params Name Type Description inboxEntryId std.string
The ID of the entry to delete.
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
Params 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.
Returns 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
Params 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
Params Name Type Description fileId std.string
The ID of the file to open.
Returns 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
Params Name Type Description fileHandle privmx.InboxFileHandle
The file handle to read from. length Int64
The number of bytes to read.
Returns 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
Params 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
Params Name Type Description fileHandle privmx.InboxFileHandle
The file handle to close.
Returns 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
Params 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
Params Name Type Description inboxId std.string
The ID of the Inbox to unsubscribe from entry events for.