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
)
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
)
Name | Type | Description |
---|---|---|
contextId | const std::string & | ID of the Context to create the Store in |
users | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access to the created Store |
managers | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store |
publicMeta | const core::Buffer & | public (unencrypted) metadata |
privateMeta | const core::Buffer & | private (encrypted) metadata |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
storeId | const std::string & | ID of the Store to update |
users | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access to the created Store |
managers | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store |
publicMeta | const core::Buffer & | public (unencrypted) metadata |
privateMeta | const core::Buffer & | private (encrypted) metadata |
version | const int64_t | current version of the updated Store |
force | const bool | force update (without checking version) |
forceGenerateNewKey | const bool | force to regenerate a key for the Store |
deleteStore
Deletes a Store by given Store ID.
void deleteStore(
const std::string &storeId
)
Name | Type | Description |
---|---|---|
storeId | const std::string & | ID of the Store to delete |
getStore
listStores
Gets a list of Stores in given Context.
core::PagingList< Store > listStores(
const std::string &contextId
const core::PagingQuery &pagingQuery
)
Name | Type | Description |
---|---|---|
contextId | const std::string & | ID of the Context to get the Stores from |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
storeId | const std::string & | ID of the Store to create the file in |
publicMeta | const core::Buffer & | public file metadata |
privateMeta | const core::Buffer & | private file metadata |
size | const int64_t | size of the file |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
fileId | const std::string & | ID of the file to update |
publicMeta | const core::Buffer & | public file metadata |
privateMeta | const core::Buffer & | private file metadata |
size | const int64_t | size of the file |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
fileId | const std::string & | ID of the file to update |
publicMeta | const core::Buffer & | public file metadata |
privateMeta | const core::Buffer & | private file metadata |
writeToFile
Writes a file data.
void writeToFile(
const int64_t fileHandle
const core::Buffer &dataChunk
)
Name | Type | Description |
---|---|---|
fileHandle | const int64_t | |
dataChunk | const core::Buffer & | file data chunk |
deleteFile
Deletes a file by given ID.
void deleteFile(
const std::string &fileId
)
Name | Type | Description |
---|---|---|
fileId | const std::string & | ID of the file to delete |
getFile
Gets a single file by the given file ID.
File getFile(
const std::string &fileId
)
Name | Type | Description |
---|---|---|
fileId | const std::string & | ID of the file to get |
Type | Description |
---|---|
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
)
Name | Type | Description |
---|---|---|
storeId | const std::string & | |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
Type | Description |
---|---|
PagingList<File> | struct containing list of files |
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 | |
length | const int64_t | size of data to read |
Type | Description |
---|---|
Buffer | buffer with file data chunk |
seekInFile
Moves read cursor.
void seekInFile(
const int64_t fileHandle
const int64_t position
)
Name | Type | Description |
---|---|---|
fileHandle | const int64_t | |
position | const int64_t | new cursor position |
closeFile
Closes the file handle.
std::string closeFile(
const int64_t fileHandle
)
Name | Type | Description |
---|---|---|
fileHandle | const int64_t |
Type | Description |
---|---|
std::string | ID of closed file |
subscribeForStoreEvents
unsubscribeFromStoreEvents
subscribeForFileEvents
Subscribes for events in given Store
void subscribeForFileEvents(
const std::string &storeId
)
Name | Type | Description |
---|---|---|
storeId | const std::string & |
unsubscribeFromFileEvents
Unsubscribes from events in given Store
void unsubscribeFromFileEvents(
const std::string &storeId
)
Name | Type | Description |
---|---|---|
storeId | const std::string & |