PrivMX DOCS
API Reference/PrivMX Endpoint/Inbox

InboxApi

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

Static Methods

create

Creates an instance of InboxApi

Params

connection

core::Connection &

instance of 'Connection'

threadApi

thread::ThreadApi &

instance of 'ThreadApi'

storeApi

store::StoreApi &

instance of 'StoreApi'

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

Returns

[InboxApi](/reference/cpp/endpoint/inbox/inbox-api) · InboxApi object

Methods

createInbox

Creates a new Inbox

Params

contextId

const std::string &

ID of the Context of the new Inbox

users

const std::vector<core::UserWithPubKey> &

vector of UserWithPubKey structs which indicates who will have access to the created Inbox

managers

const std::vector<core::UserWithPubKey> &

vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox

publicMeta

const core::Buffer &

public (unencrypted) metadata

privateMeta

const core::Buffer &

private (encrypted) metadata

filesConfig

const std::optional<inbox::FilesConfig> &

struct to override default file configuration

policies

const std::optional<core::ContainerPolicyWithoutItem> &

Inbox policies

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
const std::optional<core::ContainerPolicyWithoutItem> &policies=std::nullopt
)

Returns

std::string · ID of the created Inbox

updateInbox

Updates an existing Inbox

Params

inboxId

const std::string &

ID of the Inbox to update

users

const std::vector<core::UserWithPubKey> &

vector of UserWithPubKey structs which indicates who will have access to the created Inbox

managers

const std::vector<core::UserWithPubKey> &

vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox

publicMeta

const core::Buffer &

public (unencrypted) metadata

privateMeta

const core::Buffer &

private (encrypted) metadata

filesConfig

const std::optional<inbox::FilesConfig> &

struct to override default files configuration

version

const int64_t

current version of the updated Inbox

force

const bool

force update (without checking version)

forceGenerateNewKey

const bool

force to regenerate a key for the Inbox

policies

const std::optional<core::ContainerPolicyWithoutItem> &

Inbox policies

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
const std::optional<core::ContainerPolicyWithoutItem> &policies=std::nullopt
)

getInbox

Gets a single Inbox by given Inbox ID.

Params

inboxId

const std::string &

ID of the Inbox to get

Inbox getInbox(
const std::string &inboxId
)

Returns

[Inbox](/reference/cpp/endpoint/inbox/types#inbox) · struct containing information about the Inbox

listInboxes

Gets s list of Inboxes in given Context.

Params

contextId

const std::string &

ID of the Context to get Inboxes from

pagingQuery

const core::PagingQuery &

struct with list query parameters

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

Returns

[PagingList](/reference/cpp/endpoint/core/types#paginglist)<[InboxApi](/reference/cpp/endpoint/inbox/inbox-api)> · struct containing list of Inboxes

getInboxPublicView

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

Params

inboxId

const std::string &

ID of the Inbox to get

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

Returns

[InboxPublicView](/reference/cpp/endpoint/inbox/types#inboxpublicview) · struct containing public accessible information about the Inbox

deleteInbox

Deletes an Inbox by given Inbox ID.

Params

inboxId

const std::string &

ID of the Inbox to delete

void deleteInbox(
const std::string &inboxId
)

prepareEntry

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

Params

inboxId

const std::string &

ID of the Inbox to which the request applies

data

const core::Buffer &

entry data to send

inboxFileHandles

const std::vector<int64_t> &

optional list of file handles that will be sent with the request

userPrivKey

const std::optional<std::string> &

optional sender's private key which can be used later to encrypt data for that sender

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)

Returns

int64_t · handle

sendEntry

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

Params

inboxHandle

const int64_t

ID of the Inbox to which the request applies

void sendEntry(
const int64_t inboxHandle
)

readEntry

Gets an entry from an Inbox

Params

inboxEntryId

const std::string &

ID of an entry to read from the Inbox

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

Returns

[InboxEntry](/reference/cpp/endpoint/inbox/types#inboxentry) · struct containing data of the selected entry stored in the Inbox

listEntries

Gets list of entries in given Inbox

Params

inboxId

const std::string &

ID of the Inbox

pagingQuery

const core::PagingQuery &

struct with list query parameters

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

Returns

[PagingList](/reference/cpp/endpoint/core/types#paginglist)<[InboxEntry](/reference/cpp/endpoint/inbox/types#inboxentry)> · struct containing list of entries

deleteEntry

Delete an entry from an Inbox

Params

inboxEntryId

const std::string &

void deleteEntry(
const std::string &inboxEntryId
)

createFileHandle

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

const core::Buffer &

file's public metadata

privateMeta

const core::Buffer &

file's private metadata

fileSize

const int64_t &

size of the file to send

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

Returns

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.

Params

inboxHandle

const int64_t

ID of the Inbox to which the request applies

inboxFileHandle

const int64_t

handle to the file where the uploaded chunk belongs

dataChunk

const core::Buffer &

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

openFile

Opens a file to read.

Params

fileId

const std::string &

ID of the file to read

int64_t openFile(
const std::string &fileId
)

Returns

int64_t · handle to read file data

readFromFile

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

const int64_t

handle to the file

length

const int64_t

size of data to read

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

Returns

[Buffer](/reference/cpp/endpoint/core/buffer) · buffer with file data chunk

seekInFile

Moves file's read cursor.

Params

fileHandle

const int64_t

handle to the file

position

const int64_t

sets new cursor position

void seekInFile(
const int64_t fileHandle
const int64_t position
)

closeFile

Closes a file by given handle.

Params

fileHandle

const int64_t

handle to the file

std::string closeFile(
const int64_t fileHandle
)

Returns

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

Params

inboxId

const std::string &

void subscribeForEntryEvents(
const std::string &inboxId
)

unsubscribeFromEntryEvents

Unsubscribes from events in given Inbox

Params

inboxId

const std::string &

void unsubscribeFromEntryEvents(
const std::string &inboxId
)