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
)
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
)
Name | Type | Description |
---|---|---|
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 |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
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 |
getInbox
listInboxes
Gets s list of Inboxes in given Context.
core::PagingList< inbox::Inbox > listInboxes(
const std::string &contextId
const core::PagingQuery &pagingQuery
)
Name | Type | Description |
---|---|---|
contextId | const std::string & | ID of the Context to get Inboxes from |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
inboxId | const std::string & | ID of the Inbox to get |
Type | Description |
---|---|
InboxPublicView | struct containing public accessible information about the Inbox |
deleteInbox
Deletes an Inbox by given Inbox ID.
void deleteInbox(
const std::string &inboxId
)
Name | Type | Description |
---|---|---|
inboxId | const 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)
Name | Type | Description |
---|---|---|
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 |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
inboxHandle | const int64_t | ID of the Inbox to which the request applies |
readEntry
Gets an entry from an Inbox
inbox::InboxEntry readEntry(
const std::string &inboxEntryId
)
Name | Type | Description |
---|---|---|
inboxEntryId | const std::string & | ID of an entry to read from the Inbox |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
inboxId | const std::string & | ID of the Inbox |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
Type | Description |
---|---|
PagingList<InboxEntry> | struct containing list of entries |
deleteEntry
Delete an entry from an Inbox
void deleteEntry(
const std::string &inboxEntryId
)
Name | Type | Description |
---|---|---|
inboxEntryId | const 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
)
Name | Type | Description |
---|---|---|
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 |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
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 & |
openFile
Opens a file to read.
int64_t openFile(
const std::string &fileId
)
Name | Type | Description |
---|---|---|
fileId | const std::string & | ID of the file to read |
Type | Description |
---|---|
int64_t | handle to read file data |
readFromFile
Reads file data.
core::Buffer readFromFile(
const int64_t fileHandle
const int64_t length
)
Name | Type | Description |
---|---|---|
fileHandle | const int64_t | handle to the file |
length | const int64_t | size of data to read |
Type | Description |
---|---|
Buffer | buffer with file data chunk |
seekInFile
Moves file's read cursor.
void seekInFile(
const int64_t fileHandle
const int64_t position
)
Name | Type | Description |
---|---|---|
fileHandle | const int64_t | handle to the file |
position | const int64_t | sets new cursor position |
closeFile
Closes a file by given handle.
std::string closeFile(
const int64_t fileHandle
)
Name | Type | Description |
---|---|---|
fileHandle | const int64_t | handle to the file |
Type | Description |
---|---|
std::string | ID of closed file |
subscribeForInboxEvents
unsubscribeFromInboxEvents
subscribeForEntryEvents
Subscribes for events in given Inbox
void subscribeForEntryEvents(
const std::string &inboxId
)
Name | Type | Description |
---|---|---|
inboxId | const std::string & |
unsubscribeFromEntryEvents
Unsubscribes from events in given Inbox
void unsubscribeFromEntryEvents(
const std::string &inboxId
)
Name | Type | Description |
---|---|---|
inboxId | const std::string & |