InboxApi
Swift wrapper for privmx.NativeInboxApiWrapper, providing methods to manage Inboxes and entries within PrivMX platform.
Static Methods
create(connection:threadApi:storeApi:)
Creates an instance of ‘InboxApi’.
Params
connection
inout Connection
instance of ‘Connection’
threadApi
inout ThreadApi
instance of ‘ThreadApi’
storeApi
inout StoreApi
instance of ‘StoreApi’
Returns
InboxApi ·
InboxApi object
Methods
createInbox(contextId:users:managers:publicMeta:privateMeta:filesConfig:policies:)
Creates a new Inbox.
Params
contextId
std.string
ID of the Context of the new Inbox
users
privmx.UserWithPubKeyVector
vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managers
privmx.UserWithPubKeyVector
vector of UserWithPubKey structs which indicates who will have access (and management rights) to
publicMeta
privmx.endpoint.core.Buffer
public (unencrypted) metadata
privateMeta
privmx.endpoint.core.Buffer
private (encrypted) metadata
filesConfig
privmx.endpoint.inbox.FilesConfig?
struct to override default file configuration
policies
privmx.endpoint.core.ContainerPolicyWithoutItem?
Inbox policies
Returns
std.string ·
ID of the created Inbox
updateInbox(inboxId:users:managers:publicMeta:privateMeta:filesConfig:version:force:forceGenerateNewKey:policies:)
Updates an existing Inbox.
Params
inboxId
std.string
ID of the Inbox to update
users
privmx.UserWithPubKeyVector
vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managers
privmx.UserWithPubKeyVector
vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMeta
privmx.endpoint.core.Buffer
public (unencrypted) metadata
privateMeta
privmx.endpoint.core.Buffer
private (encrypted) metadata
filesConfig
privmx.endpoint.inbox.FilesConfig?
struct to override default files configuration
version
Int64
current version of the updated Inbox
force
Bool
force update (without checking version)
forceGenerateNewKey
Bool
force to regenerate a key for the Inbox
policies
privmx.endpoint.core.ContainerPolicyWithoutItem?
Inbox policies
getInbox(inboxId:)
Gets a single Inbox by given Inbox ID.
Params
inboxId
std.string
ID of the Inbox to get
Returns
privmx.endpoint.inbox.Inbox ·
struct containing information about the Inbox
listInboxes(contextId:pagingQuery:)
Gets s list of Inboxes in given Context.
Params
contextId
std.string
ID of the Context to get Inboxes from
pagingQuery
privmx.endpoint.core.PagingQuery
struct with list query parameters
Returns
privmx.InboxList ·
struct containing list of Inboxes
getInboxPublicView(inboxId:)
Gets public data of given Inbox. You do not have to be logged in to call this function.
Params
inboxId
std.string
ID of the Inbox to get
Returns
privmx.endpoint.inbox.InboxPublicView ·
struct containing public accessible information about the Inbox
deleteInbox(inboxId:)
Deletes an Inbox by given Inbox ID.
Params
inboxId
std.string
ID of the Inbox to delete
prepareEntry(inboxId:data:inboxFileHandles:userPrivKey:)
Prepares a request to send data to an Inbox. You do not have to be logged in to call this function.
Params
inboxId
std.string
ID of the Inbox to which the request applies
data
privmx.endpoint.core.Buffer
entry data to send
inboxFileHandles
privmx.InboxFileHandleVector
optional list of file handles that will be sent with the request
userPrivKey
std.string?
sender can optionally provide a private key, which will be used: 1) to sign the sent data, 2) to derivation of the public key, which will then be transferred along with the sent data and can be used in the future for further secure communication with the sender
Returns
privmx.EntryHandle ·
handle
sendEntry(entryHandle:)
Sends data to an Inbox. You do not have to be logged in to call this function.
Params
entryHandle
privmx.EntryHandle
ID of the Inbox to which the request applies
sendEntry(inboxHandle:)
Params
inboxHandle
privmx.InboxHandle
readEntry(inboxEntryId:)
Gets an entry from an Inbox.
Params
inboxEntryId
std.string
ID of an entry to read from the Inbox
Returns
privmx.endpoint.inbox.InboxEntry ·
struct containing data of the selected entry stored in the Inbox
listEntries(inboxId:pagingQuery:)
Gets list of entries in given Inbox.
Params
inboxId
std.string
ID of the Inbox
pagingQuery
privmx.endpoint.core.PagingQuery
struct with list query parameters
Returns
privmx.InboxEntryList ·
struct containing list of entries
deleteEntry(inboxEntryId:)
Deletes a specified entry from an Inbox.
Params
inboxEntryId
std.string
The ID of the entry to delete.
createFileHandle(publicMeta:privateMeta:fileSize:)
Creates a file handle to send a file to an Inbox. You do not have to be logged in to call this function.
Params
publicMeta
privmx.endpoint.core.Buffer
file’s public metadata
privateMeta
privmx.endpoint.core.Buffer
file’s private metadata
fileSize
Int64
size of the file to send
Returns
privmx.InboxFileHandle ·
file handle
writeToFile(entryHandle:inboxFileHandle:dataChunk:)
Sends file’s data chunk to an Inbox. (note: To send the entire file - divide it into pieces of the desired size and call the function for each fragment.) You do not have to be logged in to call this function.
Params
entryHandle
privmx.EntryHandle
Handle to the prepared Inbox entry
inboxFileHandle
privmx.InboxFileHandle
handle to the file where the uploaded chunk belongs
dataChunk
privmx.endpoint.core.Buffer
writeToFile(inboxHandle:inboxFileHandle:dataChunk:)
Params
inboxHandle
privmx.EntryHandle
inboxFileHandle
privmx.InboxFileHandle
dataChunk
privmx.endpoint.core.Buffer
openFile(fileId:)
Opens a file to read.
Params
fileId
std.string
ID of the file to read
Returns
privmx.InboxFileHandle ·
handle to read file data
readFromFile(fileHandle:length:)
Reads file data. Single read call moves the files’s cursor position by declared length or set it at the end of the file.
Params
fileHandle
privmx.InboxFileHandle
handle to the file
length
Int64
size of data to read
Returns
privmx.endpoint.core.Buffer ·
buffer with file data chunk
seekInFile(fileHandle:position:)
Moves file’s read cursor.
Params
fileHandle
privmx.InboxFileHandle
handle to the file
position
Int64
sets new cursor position
closeFile(fileHandle:)
Closes a file by given handle.
Params
fileHandle
privmx.InboxFileHandle
handle to the file
Returns
std.string ·
ID of closed file
subscribeFor(subscriptionQueries:)
Subscribe for the Inbox events on the given subscription query.
Params
subscriptionQueries
privmx.SubscriptionQueryVector
list of queries
Returns
privmx.SubscriptionIdVector ·
list of subscriptionIds in maching order to subscriptionQueries
unsubscribeFrom(subscriptionIds:)
Unsubscribe from events for the given subscriptionId.
Params
subscriptionIds
privmx.SubscriptionIdVector
list of subscriptionId
buildSubscriptionQuery(eventType:selectorType:selectorId:)
Generate subscription Query for the Inbox events.
Params
eventType
privmx.endpoint.inbox.EventType
type of event which you listen for
selectorType
privmx.endpoint.inbox.EventSelectorType
scope on which you listen for events
selectorId
std.string
ID of the selector
Returns
privmx.SubscriptionQuery ·
a properly formatted event subscription request.
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.