PrivMX DOCS
API Reference/PrivMX Endpoint Web/Threads

ThreadApi

Class representing instance of Threads API

Methods

createThread

Creates a new Thread in given Context.

Params

contextId

string

ID of the Context to create the Thread in

users

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access to the created Thread

managers

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Thread

publicMeta

Uint8Array

public (unencrypted) metadata

privateMeta

Uint8Array

private (encrypted) metadata

policies

ContainerPolicy

Thread's policies

createThread(contextId, users, managers, publicMeta, privateMeta, policies)

Returns

Promise<string> · ID of the created Thread

updateThread

Updates an existing Thread.

Params

threadId

string

ID of the Thread to update

users

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access to the created Thread

managers

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Thread

publicMeta

Uint8Array

public (unencrypted) metadata

privateMeta

Uint8Array

private (encrypted) metadata

version

number

current version of the updated Thread

force

boolean

force update (without checking version)

forceGenerateNewKey

boolean

force to regenerate a key for the Thread

policies

ContainerPolicy

Thread's policies

updateThread(threadId, users, managers, publicMeta, privateMeta, version, force, forceGenerateNewKey, policies)

deleteThread

Deletes a Thread by given Thread ID.

Params

threadId

string

ID of the Thread to delete

deleteThread(threadId)

getThread

Gets a Thread by given Thread ID.

Params

threadId

string

ID of Thread to get

getThread(threadId)

Returns

Promise<Thread> · containing info about the Thread

listThreads

Gets a list of Threads in given Context.

Params

contextId

string

ID of the Context to get the Threads from

pagingQuery

PagingQuery

with list query parameters

listThreads(contextId, pagingQuery)

Returns

Promise<PagingList<Thread>> · containing a list of Threads

getMessage

Gets a message by given message ID.

Params

messageId

string

ID of the message to get

getMessage(messageId)

Returns

Promise<Message> · containing the message

listMessages

Gets a list of messages from a Thread.

Params

threadId

string

ID of the Thread to list messages from

pagingQuery

PagingQuery

with list query parameters

listMessages(threadId, pagingQuery)

Returns

Promise<PagingList<Message>> · containing a list of messages

sendMessage

Sends a message in a Thread.

Params

threadId

string

ID of the Thread to send message to

publicMeta

Uint8Array

public message metadata

privateMeta

Uint8Array

private message metadata

data

Uint8Array

content of the message

sendMessage(threadId, publicMeta, privateMeta, data)

Returns

Promise<string> · ID of the new message

deleteMessage

Deletes a message by given message ID.

Params

messageId

string

ID of the message to delete

deleteMessage(messageId)

updateMessage

Update message in a Thread.

Params

messageId

string

ID of the message to update

publicMeta

Uint8Array

public message metadata

privateMeta

Uint8Array

private message metadata

data

Uint8Array

content of the message

updateMessage(messageId, publicMeta, privateMeta, data)

subscribeFor

Subscribe for the Thread events on the given subscription query.

Params

subscriptionQueries

string[]

list of queries

subscribeFor(subscriptionQueries)

Returns

Promise<string[]> · list of subscriptionIds in maching order to subscriptionQueries

unsubscribeFrom

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

string[]

list of subscriptionId

unsubscribeFrom(subscriptionIds)

buildSubscriptionQuery

Generate subscription Query for the Thread events.

Params

eventType

ThreadEventType

type of event which you listen for

selectorType

ThreadEventSelectorType

scope on which you listen for events

selectorId

string

ID of the selector

buildSubscriptionQuery(eventType, selectorType, selectorId)

Returns

Promise<string> · undefined undefined

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.