Skip to main content
reference

InboxApi

namespace: privmx::endpoint::inbox

InboxApi is a class representing Endpoint's API for Inboxes and their entries.

Static Methods

create

Creates an instance of InboxApi

static InboxApi create(
core::Connection &connection
thread::ThreadApi &threadApi
store::StoreApi &storeApi
)

NameTypeDescription
connectioncore::Connection &instance of 'Connection'
threadApithread::ThreadApi &instance of 'ThreadApi'
storeApistore::StoreApi &instance of 'StoreApi'

TypeDescription
InboxApi InboxApi object

Methods

createInbox

Creates a new Inbox

std::string createInbox(
const std::string &contextId
const std::vector<core::UserWithPubKey> &users
const std::vector<core::UserWithPubKey> &managers
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const std::optional<inbox::FilesConfig> &filesConfig
)

NameTypeDescription
contextIdconst std::string &ID of the Context of the new Inbox
usersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetaconst core::Buffer &public (unencrypted) metadata
privateMetaconst core::Buffer &private (encrypted) metadata
filesConfigconst std::optional<inbox::FilesConfig> &struct to override default file configuration

TypeDescription
std::string ID of the created Inbox

updateInbox

Updates an existing Inbox

void updateInbox(
const std::string &inboxId
const std::vector<core::UserWithPubKey> &users
const std::vector<core::UserWithPubKey> &managers
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const std::optional<inbox::FilesConfig> &filesConfig
const int64_t version
const bool force
const bool forceGenerateNewKey
)

NameTypeDescription
inboxIdconst std::string &ID of the Inbox to update
usersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetaconst core::Buffer &public (unencrypted) metadata
privateMetaconst core::Buffer &private (encrypted) metadata
filesConfigconst std::optional<inbox::FilesConfig> &struct to override default files configuration
versionconst int64_tcurrent version of the updated Inbox
forceconst boolforce update (without checking version)
forceGenerateNewKeyconst boolforce to regenerate a key for the Inbox

getInbox

Gets a single Inbox by given Inbox ID.

Inbox getInbox(
const std::string &inboxId
)

NameTypeDescription
inboxIdconst std::string &ID of the Inbox to get

TypeDescription
Inbox struct containing information about the Inbox

listInboxes

Gets s list of Inboxes in given Context.

core::PagingList< inbox::Inbox > listInboxes(
const std::string &contextId
const core::PagingQuery &pagingQuery
)

NameTypeDescription
contextIdconst std::string &ID of the Context to get Inboxes from
pagingQueryconst core::PagingQuery &struct with list query parameters

TypeDescription
PagingList<InboxApi> struct containing list of Inboxes

getInboxPublicView

Gets public data of given Inbox You do not have to be logged in to call this function.

inbox::InboxPublicView getInboxPublicView(
const std::string &inboxId
)

NameTypeDescription
inboxIdconst std::string &ID of the Inbox to get

TypeDescription
InboxPublicView struct containing public accessible information about the Inbox

deleteInbox

Deletes an Inbox by given Inbox ID.

void deleteInbox(
const std::string &inboxId
)

NameTypeDescription
inboxIdconst std::string &ID of the Inbox to delete

prepareEntry

Prepares a request to send data to an Inbox You do not have to be logged in to call this function.

int64_t prepareEntry(const std::string &inboxId
const core::Buffer &data
const std::vector<int64_t> &inboxFileHandles=std::vector<int64_t>()
const std::optional<std::string> &userPrivKey=std::nullopt)

NameTypeDescription
inboxIdconst std::string &ID of the Inbox to which the request applies
dataconst core::Buffer &entry data to send
inboxFileHandlesconst std::vector<int64_t> &optional list of file handles that will be sent with the request
userPrivKeyconst std::optional<std::string> &optional sender's private key which can be used later to encrypt data for that sender

TypeDescription
int64_t handle

sendEntry

Sends data to an Inbox You do not have to be logged in to call this function.

void sendEntry(
const int64_t inboxHandle
)

NameTypeDescription
inboxHandleconst int64_tID of the Inbox to which the request applies

readEntry

Gets an entry from an Inbox

inbox::InboxEntry readEntry(
const std::string &inboxEntryId
)

NameTypeDescription
inboxEntryIdconst std::string &ID of an entry to read from the Inbox

TypeDescription
InboxEntry struct containing data of the selected entry stored in the Inbox

listEntries

Gets list of entries in given Inbox

core::PagingList< inbox::InboxEntry > listEntries(
const std::string &inboxId
const core::PagingQuery &pagingQuery
)

NameTypeDescription
inboxIdconst std::string &ID of the Inbox
pagingQueryconst core::PagingQuery &struct with list query parameters

TypeDescription
PagingList<InboxEntry> struct containing list of entries

deleteEntry

Delete an entry from an Inbox

void deleteEntry(
const std::string &inboxEntryId
)

NameTypeDescription
inboxEntryIdconst std::string &

createFileHandle

Creates a file handle to send a file to an Inbox You do not have to be logged in to call this function.

int64_t createFileHandle(
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const int64_t &fileSize
)

NameTypeDescription
publicMetaconst core::Buffer &file's public metadata
privateMetaconst core::Buffer &file's private metadata
fileSizeconst int64_t &size of the file to send

TypeDescription
int64_t file handle

writeToFile

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.

void writeToFile(
const int64_t inboxHandle
const int64_t inboxFileHandle
const core::Buffer &dataChunk
)

NameTypeDescription
inboxHandleconst int64_tID of the Inbox to which the request applies
inboxFileHandleconst int64_thandle to the file where the uploaded chunk belongs
dataChunkconst core::Buffer &

openFile

Opens a file to read.

int64_t openFile(
const std::string &fileId
)

NameTypeDescription
fileIdconst std::string &ID of the file to read

TypeDescription
int64_t handle to read file data

readFromFile

Reads file data.

core::Buffer readFromFile(
const int64_t fileHandle
const int64_t length
)

NameTypeDescription
fileHandleconst int64_thandle to the file
lengthconst int64_tsize of data to read

TypeDescription
Buffer buffer with file data chunk

seekInFile

Moves file's read cursor.

void seekInFile(
const int64_t fileHandle
const int64_t position
)

NameTypeDescription
fileHandleconst int64_thandle to the file
positionconst int64_tsets new cursor position

closeFile

Closes a file by given handle.

std::string closeFile(
const int64_t fileHandle
)

NameTypeDescription
fileHandleconst int64_thandle to the file

TypeDescription
std::string ID of closed file

subscribeForInboxEvents

Subscribes for the Inbox module main events.

void subscribeForInboxEvents()

unsubscribeFromInboxEvents

Unsubscribes from the Inbox module main events.

void unsubscribeFromInboxEvents()

subscribeForEntryEvents

Subscribes for events in given Inbox

void subscribeForEntryEvents(
const std::string &inboxId
)

NameTypeDescription
inboxIdconst std::string &

unsubscribeFromEntryEvents

Unsubscribes from events in given Inbox

void unsubscribeFromEntryEvents(
const std::string &inboxId
)

NameTypeDescription
inboxIdconst std::string &