PrivMX Endpoint v2.7.0
Loading...
Searching...
No Matches
privmx::endpoint::inbox::InboxApi Class Reference

#include <privmx/endpoint/inbox/InboxApi.hpp>

Inheritance diagram for privmx::endpoint::inbox::InboxApi:
Collaboration diagram for privmx::endpoint::inbox::InboxApi:

Public Member Functions

 InboxApi ()
 InboxApi (const InboxApi &obj)
InboxApioperator= (const InboxApi &obj)
 InboxApi (InboxApi &&obj)
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)
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)
Inbox getInbox (const std::string &inboxId)
core::PagingList< inbox::InboxlistInboxes (const std::string &contextId, const core::PagingQuery &pagingQuery)
inbox::InboxPublicView getInboxPublicView (const std::string &inboxId)
void deleteInbox (const std::string &inboxId)
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)
void sendEntry (const int64_t inboxHandle)
inbox::InboxEntry readEntry (const std::string &inboxEntryId)
core::PagingList< inbox::InboxEntrylistEntries (const std::string &inboxId, const core::PagingQuery &pagingQuery)
void deleteEntry (const std::string &inboxEntryId)
int64_t createFileHandle (const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t &fileSize)
void writeToFile (const int64_t inboxHandle, const int64_t inboxFileHandle, const core::Buffer &dataChunk)
int64_t openFile (const std::string &fileId)
core::Buffer readFromFile (const int64_t fileHandle, const int64_t length)
void seekInFile (const int64_t fileHandle, const int64_t position)
std::string closeFile (const int64_t fileHandle)
std::vector< std::string > subscribeFor (const std::vector< std::string > &subscriptionQueries)
void unsubscribeFrom (const std::vector< std::string > &subscriptionIds)
std::string buildSubscriptionQuery (EventType eventType, EventSelectorType selectorType, const std::string &selectorId)
Public Member Functions inherited from privmx::endpoint::core::ExtendedPointer< InboxApiImpl >
ExtendedPointer & operator= (const ExtendedPointer &obj)
std::shared_ptr< InboxApiImpl > getImpl () const

Static Public Member Functions

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

Additional Inherited Members

Protected Member Functions inherited from privmx::endpoint::core::ExtendedPointer< InboxApiImpl >
void attachToPtrIfPossible ()
void detachFromPtrIfPossible ()
Protected Attributes inherited from privmx::endpoint::core::ExtendedPointer< InboxApiImpl >
std::weak_ptr< InboxApiImpl > _ptr

Detailed Description

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

Constructor & Destructor Documentation

◆ InboxApi()

privmx::endpoint::inbox::InboxApi::InboxApi ( )

//doc-gen:ignore

Member Function Documentation

◆ buildSubscriptionQuery()

std::string privmx::endpoint::inbox::InboxApi::buildSubscriptionQuery ( EventType eventType,
EventSelectorType selectorType,
const std::string & selectorId )

Generate subscription Query for the Inbox events.

Parameters
eventTypetype of event which you listen for
selectorTypescope on which you listen for events
selectorIdID of the selector

◆ closeFile()

std::string privmx::endpoint::inbox::InboxApi::closeFile ( const int64_t fileHandle)

Closes a file by given handle.

Parameters
fileHandlehandle to the file
Returns
ID of closed file

◆ create()

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

Creates an instance of 'InboxApi'.

Parameters
connectioninstance of 'Connection'
threadApiinstance of 'ThreadApi'
storeApiinstance of 'StoreApi'
Returns
InboxApi object

◆ createFileHandle()

int64_t privmx::endpoint::inbox::InboxApi::createFileHandle ( const core::Buffer & publicMeta,
const core::Buffer & privateMeta,
const int64_t & fileSize )

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

Parameters
publicMetafile's public metadata
privateMetafile's private metadata
fileSizesize of the file to send
Returns
file handle

◆ createInbox()

std::string privmx::endpoint::inbox::InboxApi::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 )

Creates a new Inbox.

Parameters
contextIdID of the Context of the new Inbox
usersvector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersvector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetapublic (unencrypted) metadata
privateMetaprivate (encrypted) metadata
filesConfigstruct to override default file configuration
policiesInbox policies
Returns
ID of the created Inbox

◆ deleteEntry()

void privmx::endpoint::inbox::InboxApi::deleteEntry ( const std::string & inboxEntryId)

Delete an entry from an Inbox.

Parameters
IDof an entry to delete

◆ deleteInbox()

void privmx::endpoint::inbox::InboxApi::deleteInbox ( const std::string & inboxId)

Deletes an Inbox by given Inbox ID.

Parameters
inboxIdID of the Inbox to delete

◆ getInbox()

Inbox privmx::endpoint::inbox::InboxApi::getInbox ( const std::string & inboxId)

Gets a single Inbox by given Inbox ID.

Parameters
inboxIdID of the Inbox to get
Returns
struct containing information about the Inbox

◆ getInboxPublicView()

inbox::InboxPublicView privmx::endpoint::inbox::InboxApi::getInboxPublicView ( const std::string & inboxId)

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

Parameters
inboxIdID of the Inbox to get
Returns
struct containing public accessible information about the Inbox

◆ listEntries()

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

Gets list of entries in given Inbox.

Parameters
inboxIdID of the Inbox
pagingQuerystruct with list query parameters
Returns
struct containing list of entries

◆ listInboxes()

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

Gets s list of Inboxes in given Context.

Parameters
contextIdID of the Context to get Inboxes from
pagingQuerystruct with list query parameters
Returns
struct containing list of Inboxes

◆ openFile()

int64_t privmx::endpoint::inbox::InboxApi::openFile ( const std::string & fileId)

Opens a file to read.

Parameters
fileIdID of the file to read
Returns
handle to read file data

◆ prepareEntry()

int64_t privmx::endpoint::inbox::InboxApi::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 )

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

Parameters
inboxIdID of the Inbox to which the request applies
dataentry data to send
inboxFileHandlesoptional list of file handles that will be sent with the request
userPrivKeysender 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
handle

◆ readEntry()

inbox::InboxEntry privmx::endpoint::inbox::InboxApi::readEntry ( const std::string & inboxEntryId)

Gets an entry from an Inbox.

Parameters
inboxEntryIdID of an entry to read from the Inbox
Returns
struct containing data of the selected entry stored in the Inbox

◆ readFromFile()

core::Buffer privmx::endpoint::inbox::InboxApi::readFromFile ( const int64_t fileHandle,
const int64_t 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.

Parameters
fileHandlehandle to the file
lengthsize of data to read
Returns
buffer with file data chunk

◆ seekInFile()

void privmx::endpoint::inbox::InboxApi::seekInFile ( const int64_t fileHandle,
const int64_t position )

Moves file's read cursor.

Parameters
fileHandlehandle to the file
positionsets new cursor position

◆ sendEntry()

void privmx::endpoint::inbox::InboxApi::sendEntry ( const int64_t inboxHandle)

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

Parameters
inboxHandleID of the Inbox to which the request applies

◆ subscribeFor()

std::vector< std::string > privmx::endpoint::inbox::InboxApi::subscribeFor ( const std::vector< std::string > & subscriptionQueries)

Subscribe for the Inbox events on the given subscription query.

Parameters
subscriptionQuerieslist of queries
Returns
list of subscriptionIds in maching order to subscriptionQueries

◆ unsubscribeFrom()

void privmx::endpoint::inbox::InboxApi::unsubscribeFrom ( const std::vector< std::string > & subscriptionIds)

Unsubscribe from events for the given subscriptionId.

Parameters
subscriptionIdslist of subscriptionId

◆ updateInbox()

void privmx::endpoint::inbox::InboxApi::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 )

Updates an existing Inbox.

Parameters
inboxIdID of the Inbox to update
usersvector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersvector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetapublic (unencrypted) metadata
privateMetaprivate (encrypted) metadata
filesConfigstruct to override default files configuration
versioncurrent version of the updated Inbox
forceforce update (without checking version)
forceGenerateNewKeyforce to regenerate a key for the Inbox
policiesInbox policies

◆ writeToFile()

void privmx::endpoint::inbox::InboxApi::writeToFile ( const int64_t inboxHandle,
const int64_t inboxFileHandle,
const core::Buffer & 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.

Parameters
inboxHandleHandle to the prepared Inbox entry
inboxFileHandlehandle to the file where the uploaded chunk belongs
BufferdataChunk - file chunk to send

The documentation for this class was generated from the following file: