Skip to main content
reference

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
)

NameTypeDescription
connetioncore::Connection &

TypeDescription
ThreadApi ThreadApi object

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
)

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

TypeDescription
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
)

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

deleteThread

Deletes a Thread by given Thread ID.

void deleteThread(
const std::string &threadId
)

NameTypeDescription
threadIdconst std::string &ID of the Thread to delete

getThread

Gets a Thread by given Thread ID.

Thread getThread(
const std::string &threadId
)

NameTypeDescription
threadIdconst std::string &ID of Thread to get

TypeDescription
Thread Thread struct containing info about the Thread

listThreads

Gets a list of Threads in given Context.

core::PagingList< Thread > listThreads(
const std::string &contextId
const core::PagingQuery &pagingQuery
)

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

TypeDescription
PagingList<Thread> struct containing a list of Threads

getMessage

Gets a message by given message ID.

Message getMessage(
const std::string &messageId
)

NameTypeDescription
messageIdconst std::string &

TypeDescription
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
)

NameTypeDescription
threadIdconst std::string &ID of the Thread to list messages from
pagingQueryconst core::PagingQuery &struct with list query parameters

TypeDescription
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
)

NameTypeDescription
threadIdconst std::string &ID of the Thread to send message to
publicMetaconst core::Buffer &public message metadata
privateMetaconst core::Buffer &private message metadata
dataconst core::Buffer &content of the message

TypeDescription
std::string ID of the new message

deleteMessage

Deletes a message by given message ID.

void deleteMessage(
const std::string &messageId
)

NameTypeDescription
messageIdconst 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
)

NameTypeDescription
messageIdconst std::string &ID of the message to update
publicMetaconst core::Buffer &public message metadata
privateMetaconst core::Buffer &private message metadata
dataconst core::Buffer &content of the message

subscribeForThreadEvents

Subscribes for the Thread module main events.

void subscribeForThreadEvents()

unsubscribeFromThreadEvents

Unsubscribes from the Thread module main events.

void unsubscribeFromThreadEvents()

subscribeForMessageEvents

Subscribes for events in given Thread

void subscribeForMessageEvents(
const std::string &threadId
)

NameTypeDescription
threadIdconst std::string &

unsubscribeFromMessageEvents

Unsubscribes from events in given Thread

void unsubscribeFromMessageEvents(
const std::string &threadId
)

NameTypeDescription
threadIdconst std::string &