Skip to main content

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

NameTypeDescription
inboxApiany PrivMXInboxprovider of `PrivMXInbox` API
inboxIdStringId of the Inbox in which the Entry is supposed to appear
dataDataarbitrary data that will appear as a mesasage in the Inbox
fileSources[any FileDataSource]list of sources of data for Files attached to the Entry
userPrivateKeyString?Optional identity of the Sender.

TypeDescription
InboxEntryHandler an instance of `InboxEntryHandler`

Methods

sendFiles()

Uploads the files associated with the Entry.

public func sendFiles(
) throws -> InboxEntryHandlerState

TypeDescription
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