PrivMX DOCS
API Reference/PrivMX Endpoint/Thread

ThreadApi

ThreadApi is a class representing Endpoint's API for Threads and their messages.

Static Methods

create

Creates an instance of ThreadApi

Params

connetion

core::Connection &

static ThreadApi create(
core::Connection &connetion
)

Returns

[ThreadApi](/reference/cpp/endpoint/thread/thread-api) · ThreadApi object

Methods

createThread

Creates a new Thread in given Context.

Params

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

policies

const std::optional<core::ContainerPolicy> &

Thread policies

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
const std::optional<core::ContainerPolicy> &policies=std::nullopt
)

Returns

std::string · ID of the created Thread

updateThread

Updates an existing Thread

Params

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

policies

const std::optional<core::ContainerPolicy> &

Thread policies

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
const std::optional<core::ContainerPolicy> &policies=std::nullopt
)

deleteThread

Deletes a Thread by given Thread ID.

Params

threadId

const std::string &

ID of the Thread to delete

void deleteThread(
const std::string &threadId
)

getThread

Gets a Thread by given Thread ID.

Params

threadId

const std::string &

ID of Thread to get

Thread getThread(
const std::string &threadId
)

Returns

[Thread](/reference/cpp/endpoint/thread/types#thread) · Thread struct containing info about the Thread

listThreads

Gets a list of Threads in given Context.

Params

contextId

const std::string &

ID of the Context to get the Threads from

pagingQuery

const core::PagingQuery &

struct with list query parameters

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

Returns

[PagingList](/reference/cpp/endpoint/core/types#paginglist)<[Thread](/reference/cpp/endpoint/thread/types#thread)> · struct containing a list of Threads

getMessage

Gets a message by given message ID.

Params

messageId

const std::string &

Message getMessage(
const std::string &messageId
)

Returns

[Message](/reference/cpp/endpoint/thread/types#message) · struct containing the message

listMessages

Gets a list of messages from a Thread

Params

threadId

const std::string &

ID of the Thread to list messages from

pagingQuery

const core::PagingQuery &

struct with list query parameters

core::PagingList< Message > listMessages(
const std::string &threadId
const core::PagingQuery &pagingQuery
)

Returns

[PagingList](/reference/cpp/endpoint/core/types#paginglist)<[Message](/reference/cpp/endpoint/thread/types#message)> · struct containing a list of messages

sendMessage

Sends a message in a Thread

Params

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

std::string sendMessage(
const std::string &threadId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const core::Buffer &data
)

Returns

std::string · ID of the new message

deleteMessage

Deletes a message by given message ID.

Params

messageId

const std::string &

ID of the message to delete

void deleteMessage(
const std::string &messageId
)

updateMessage

Update message in a Thread

Params

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

void updateMessage(
const std::string &messageId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const core::Buffer &data
)

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

Params

threadId

const std::string &

void subscribeForMessageEvents(
const std::string &threadId
)

unsubscribeFromMessageEvents

Unsubscribes from events in given Thread

Params

threadId

const std::string &

void unsubscribeFromMessageEvents(
const std::string &threadId
)