InboxEntryHandler
Class wrapping the process of creating and uploading an Inbox Entry.
Fields
RecommendedChunkSize
Recommended chunk size for file transfers, suggested by the endpoint library.
public static let RecommendedChunkSize :Int64 = 131072
state
The current state
public private(set) var state : InboxEntryHandlerState
Static Methods
prepareInboxEntryHandler(using:in:containing:sending:as:)
Creates a new InboxEntryHandler
for sending an entry to an Inbox.
If fileSources is an empty array, the created handler will be in .filesSent
, otherwise it will be in .prepared
.
public static func prepareInboxEntryHandler(
using inboxApi: any PrivMXInbox,
in inboxId:String,
containing data:Data,
sending fileSources: [any FileDataSource],
as userPrivateKey:String?
) throws -> InboxEntryHandler
Name | Type | Description |
---|---|---|
inboxApi | any PrivMXInbox | provider of `PrivMXInbox` API |
inboxId | String | Id of the Inbox in which the Entry is supposed to appear |
data | Data | arbitrary data that will appear as a mesasage in the Inbox |
fileSources | [any FileDataSource] | list of sources of data for Files attached to the Entry |
userPrivateKey | String? | Optional identity of the Sender. |
Type | Description |
---|---|
InboxEntryHandler | an instance of `InboxEntryHandler` |
Methods
sendFiles()
Uploads the files associated with the Entry.
public func sendFiles(
) throws -> InboxEntryHandlerState
Type | Description |
---|---|
InboxEntryHandlerState | the state of the Handler |
cancel()
Aborts sending of the files, if they haven’t been sent already
public func cancel(
) throws -> Void
sendEntry()
Sends the entry, completing the process and adding it to the Inbox.
public func sendEntry(
) throws