PrivMX DOCS
API Reference/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 · 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's 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's 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 · 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

core::PagingList<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 · 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

core::PagingList<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
)

subscribeFor

Subscribe for the Thread events on the given subscription query.

Params

subscriptionQueries

const std::vector<std::string> &

list of queries

std::vector< std::string > subscribeFor(
const std::vector<std::string> &subscriptionQueries
)

Returns

std::vector<std::string> · list of subscriptionIds in maching order to subscriptionQueries

unsubscribeFrom

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

const std::vector<std::string> &

list of subscriptionId

void unsubscribeFrom(
const std::vector<std::string> &subscriptionIds
)

buildSubscriptionQuery

Generate subscription Query for the Thread events.

Params

eventType

EventType

type of event which you listen for

selectorType

EventSelectorType

scope on which you listen for events

selectorId

const std::string &

ID of the selector

std::string buildSubscriptionQuery(
EventType eventType
EventSelectorType selectorType
const std::string &selectorId
)

Returns

std::string ·

We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.