PrivMX DOCS
API Reference/PrivMX Endpoint Swift/Inboxes

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 using a connection, threadApi, and StoreApi.

Params

connection

inout Connection

The connection object to interact with PrivMX.

threadApi

inout ThreadApi

The Thread API instance.

storeApi

inout StoreApi

The Store API instance.

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

Returns

InboxApi · A new InboxApi instance.

Methods

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

Creates a new Inbox in the specified context. If policies argument is set to nil, the default policies will be applied.

Params

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.

policies

privmx.endpoint.core.ContainerPolicyWithoutItem?

A set of policies for the Container.

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?,
policies: privmx.endpoint.core.ContainerPolicyWithoutItem? = nil
) throws -> std.string

Returns

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

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

Updates an existing Inbox with new metadata and configuration. If policies argument is set to nil, the default policies will be applied.

Params

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.

policies

privmx.endpoint.core.ContainerPolicyWithoutItem?

New set of policies for the Container.

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,
policies: privmx.endpoint.core.ContainerPolicyWithoutItem? = nil
) throws -> Void

getInbox(inboxId:)

Retrieves detailed information about a specific Inbox.

Params

inboxId

std.string

The ID of the Inbox to retrieve.

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

Returns

privmx.endpoint.inbox.Inbox · An Inbox instance containing Inbox details.

listInboxes(contextId:pagingQuery:)

Lists all Inboxes within a specified context.

Params

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.

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

Returns

privmx.InboxList · An InboxList containing the list of Inboxes.

getInboxPublicView(inboxId:)

Retrieves the public view of a specific Inbox.

Params

inboxId

std.string

The ID of the Inbox to retrieve the public view for.

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

Returns

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

deleteInbox(inboxId:)

Deletes a specified Inbox.

Params

inboxId

std.string

The ID of the Inbox to delete.

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

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.

Params

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.

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

Returns

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.

Params

inboxHandle

privmx.InboxHandle

The handle of the prepared entry to be sent.

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

readEntry(inboxEntryId:)

Retrieves an entry from a specific Inbox.

Params

inboxEntryId

std.string

The ID of the entry to be retrieved.

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

Returns

privmx.endpoint.inbox.InboxEntry · An InboxEntry instance representing the entry.

listEntries(inboxId:pagingQuery:)

Lists entries within a specific Inbox.

Params

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.

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

Returns

privmx.InboxEntryList · An InboxEntryList containing the list of entries.

deleteEntry(inboxEntryId:)

Deletes a specified entry from an Inbox.

Params

inboxEntryId

std.string

The ID of the entry to delete.

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

createFileHandle(publicMeta:privateMeta:fileSize:)

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

Params

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.

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

Returns

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.

Params

inboxHandle

privmx.InboxHandle

Handle to the prepared Inbox entry

inboxFileHandle

privmx.InboxFileHandle

handle to the file where the uploaded chunk belongs

dataChunk

privmx.endpoint.core.Buffer

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

openFile(fileId:)

Opens a file for reading from the Inbox.

Params

fileId

std.string

The ID of the file to open.

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

Returns

privmx.InboxFileHandle · An InboxFileHandle for reading from the file.

readFromFile(fileHandle:length:)

Reads data from an open file in the inbox.

Params

fileHandle

privmx.InboxFileHandle

The file handle to read from.

length

Int64

The number of bytes to read.

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

Returns

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

seekInFile(fileHandle:position:)

Moves the read cursor in an open file.

Params

fileHandle

privmx.InboxFileHandle

The file handle to move the cursor in.

position

Int64

The new position of the cursor in bytes.

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

closeFile(fileHandle:)

Closes an open file in the Inbox.

Params

fileHandle

privmx.InboxFileHandle

The file handle to close.

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

Returns

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.

Params

inboxId

std.string

The ID of the Inbox to subscribe to entry events for.

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

unsubscribeFromEntryEvents(inboxId:)

Unsubscribes from entry-related events within a specific Inbox.

Params

inboxId

std.string

The ID of the Inbox to unsubscribe from entry events for.

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

We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.