Skip to main content
reference

StoreApi

namespace: privmx::endpoint::store

StoreApi is a class representing Endpoint's API for Stores and their files.

Static Methods

create

Creates an instance of StoreApi

static StoreApi create(
core::Connection &connection
)

NameTypeDescription
connectioncore::Connection &instance of 'Connection'

TypeDescription
StoreApi StoreApi object

Methods

createStore

Creates a new Store in given Context.

std::string createStore(
const std::string &contextId
const std::vector<core::UserWithPubKey> &users
const std::vector<core::UserWithPubKey> &managers
const core::Buffer &publicMeta
const core::Buffer &privateMeta
)

NameTypeDescription
contextIdconst std::string &ID of the Context to create the Store in
usersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access to the created Store
managersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store
publicMetaconst core::Buffer &public (unencrypted) metadata
privateMetaconst core::Buffer &private (encrypted) metadata

TypeDescription
std::string created Store ID

updateStore

Updates an existing Store

void updateStore(
const std::string &storeId
const std::vector<core::UserWithPubKey> &users
const std::vector<core::UserWithPubKey> &managers
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const int64_t version
const bool force
const bool forceGenerateNewKey
)

NameTypeDescription
storeIdconst std::string &ID of the Store to update
usersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access to the created Store
managersconst std::vector<core::UserWithPubKey> &vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store
publicMetaconst core::Buffer &public (unencrypted) metadata
privateMetaconst core::Buffer &private (encrypted) metadata
versionconst int64_tcurrent version of the updated Store
forceconst boolforce update (without checking version)
forceGenerateNewKeyconst boolforce to regenerate a key for the Store

deleteStore

Deletes a Store by given Store ID.

void deleteStore(
const std::string &storeId
)

NameTypeDescription
storeIdconst std::string &ID of the Store to delete

getStore

Gets a single Store by given Store ID.

Store getStore(
const std::string &storeId
)

NameTypeDescription
storeIdconst std::string &ID of the Store to get

TypeDescription
Store struct containing information about the Store

listStores

Gets a list of Stores in given Context.

core::PagingList< Store > listStores(
const std::string &contextId
const core::PagingQuery &pagingQuery
)

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

TypeDescription
PagingList<Store> struct containing list of Stores

createFile

Creates a new file in a Store

int64_t createFile(
const std::string &storeId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const int64_t size
)

NameTypeDescription
storeIdconst std::string &ID of the Store to create the file in
publicMetaconst core::Buffer &public file metadata
privateMetaconst core::Buffer &private file metadata
sizeconst int64_tsize of the file

TypeDescription
int64_t handle to write data

updateFile

Update an existing file in a Store

int64_t updateFile(
const std::string &fileId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const int64_t size
)

NameTypeDescription
fileIdconst std::string &ID of the file to update
publicMetaconst core::Buffer &public file metadata
privateMetaconst core::Buffer &private file metadata
sizeconst int64_tsize of the file

TypeDescription
int64_t handle to write file data

updateFileMeta

Update metadata of an existing file in a Store

void updateFileMeta(
const std::string &fileId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
)

NameTypeDescription
fileIdconst std::string &ID of the file to update
publicMetaconst core::Buffer &public file metadata
privateMetaconst core::Buffer &private file metadata

writeToFile

Writes a file data.

void writeToFile(
const int64_t fileHandle
const core::Buffer &dataChunk
)

NameTypeDescription
fileHandleconst int64_t
dataChunkconst core::Buffer &file data chunk

deleteFile

Deletes a file by given ID.

void deleteFile(
const std::string &fileId
)

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

getFile

Gets a single file by the given file ID.

File getFile(
const std::string &fileId
)

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

TypeDescription
File struct containing information about the file

listFiles

Gets a list of files in given Store

core::PagingList< File > listFiles(
const std::string &storeId
const core::PagingQuery &pagingQuery
)

NameTypeDescription
storeIdconst std::string &
pagingQueryconst core::PagingQuery &struct with list query parameters

TypeDescription
PagingList<File> struct containing list of files

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_t
lengthconst int64_tsize of data to read

TypeDescription
Buffer buffer with file data chunk

seekInFile

Moves read cursor.

void seekInFile(
const int64_t fileHandle
const int64_t position
)

NameTypeDescription
fileHandleconst int64_t
positionconst int64_tnew cursor position

closeFile

Closes the file handle.

std::string closeFile(
const int64_t fileHandle
)

NameTypeDescription
fileHandleconst int64_t

TypeDescription
std::string ID of closed file

subscribeForStoreEvents

Subscribes for the Store module main events.

void subscribeForStoreEvents()

unsubscribeFromStoreEvents

Unsubscribes from the Store module main events.

void unsubscribeFromStoreEvents()

subscribeForFileEvents

Subscribes for events in given Store

void subscribeForFileEvents(
const std::string &storeId
)

NameTypeDescription
storeIdconst std::string &

unsubscribeFromFileEvents

Unsubscribes from events in given Store

void unsubscribeFromFileEvents(
const std::string &storeId
)

NameTypeDescription
storeIdconst std::string &