ThreadApi
namespace: privmx::endpoint::thread
ThreadApi is a class representing Endpoint's API for Threads and their messages.
Static Methods
create
Creates an instance of ThreadApi
static ThreadApi create(
core::Connection &connetion
)
Methods
createThread
Creates a new Thread in given Context.
std::string createThread(
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 Thread in |
users | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access to the created Thread |
managers | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Thread |
publicMeta | const core::Buffer & | public (unencrypted) metadata |
privateMeta | const core::Buffer & | private (encrypted) metadata |
Type | Description |
---|---|
std::string | ID of the created Thread |
updateThread
Updates an existing Thread
void updateThread(
const std::string &threadId
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 |
---|---|---|
threadId | const std::string & | ID of the Thread to update |
users | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access to the created Thread |
managers | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Thread |
publicMeta | const core::Buffer & | public (unencrypted) metadata |
privateMeta | const core::Buffer & | private (encrypted) metadata |
version | const int64_t | current version of the updated Thread |
force | const bool | force update (without checking version) |
forceGenerateNewKey | const bool | force to regenerate a key for the Thread |
deleteThread
Deletes a Thread by given Thread ID.
void deleteThread(
const std::string &threadId
)
Name | Type | Description |
---|---|---|
threadId | const std::string & | ID of the Thread to delete |
getThread
listThreads
Gets a list of Threads in given Context.
core::PagingList< Thread > listThreads(
const std::string &contextId
const core::PagingQuery &pagingQuery
)
Name | Type | Description |
---|---|---|
contextId | const std::string & | ID of the Context to get the Threads from |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
Type | Description |
---|---|
PagingList<Thread> | struct containing a list of Threads |
getMessage
Gets a message by given message ID.
Message getMessage(
const std::string &messageId
)
Name | Type | Description |
---|---|---|
messageId | const std::string & |
Type | Description |
---|---|
Message | struct containing the message |
listMessages
Gets a list of messages from a Thread
core::PagingList< Message > listMessages(
const std::string &threadId
const core::PagingQuery &pagingQuery
)
Name | Type | Description |
---|---|---|
threadId | const std::string & | ID of the Thread to list messages from |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
Type | Description |
---|---|
PagingList<Message> | struct containing a list of messages |
sendMessage
Sends a message in a Thread
std::string sendMessage(
const std::string &threadId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const core::Buffer &data
)
Name | Type | Description |
---|---|---|
threadId | const std::string & | ID of the Thread to send message to |
publicMeta | const core::Buffer & | public message metadata |
privateMeta | const core::Buffer & | private message metadata |
data | const core::Buffer & | content of the message |
Type | Description |
---|---|
std::string | ID of the new message |
deleteMessage
Deletes a message by given message ID.
void deleteMessage(
const std::string &messageId
)
Name | Type | Description |
---|---|---|
messageId | const std::string & | ID of the message to delete |
updateMessage
Update message in a Thread
void updateMessage(
const std::string &messageId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const core::Buffer &data
)
Name | Type | Description |
---|---|---|
messageId | const std::string & | ID of the message to update |
publicMeta | const core::Buffer & | public message metadata |
privateMeta | const core::Buffer & | private message metadata |
data | const core::Buffer & | content of the message |
subscribeForThreadEvents
unsubscribeFromThreadEvents
subscribeForMessageEvents
Subscribes for events in given Thread
void subscribeForMessageEvents(
const std::string &threadId
)
Name | Type | Description |
---|---|---|
threadId | const std::string & |
unsubscribeFromMessageEvents
Unsubscribes from events in given Thread
void unsubscribeFromMessageEvents(
const std::string &threadId
)
Name | Type | Description |
---|---|---|
threadId | const std::string & |