Skip to main content
reference

Threads

Class representing instance of Threads API

Methods

createThread

Creates a new Thread in given Context.

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

NameTypeDescription
contextIdstringID of the Context to create the Thread in
usersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access to the created Thread
managersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Thread
publicMetaUint8Arraypublic (unencrypted) metadata
privateMetaUint8Arrayprivate (encrypted) metadata

TypeDescription
Promise<string> ID of the created Thread

updateThread

Updates an existing Thread.

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

NameTypeDescription
threadIdstringID of the Thread to update
usersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access to the created Thread
managersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Thread
publicMetaUint8Arraypublic (unencrypted) metadata
privateMetaUint8Arrayprivate (encrypted) metadata
versionnumbercurrent version of the updated Thread
forcebooleanforce update (without checking version)
forceGenerateNewKeybooleanforce to regenerate a key for the Thread

deleteThread

Deletes a Thread by given Thread ID.

deleteThread(threadId)

NameTypeDescription
threadIdstringID of the Thread to delete

getThread

Gets a Thread by given Thread ID.

getThread(threadId)

NameTypeDescription
threadIdstringID of Thread to get

TypeDescription
Promise<Thread> struct containing info about the Thread

listThreads

Gets a list of Threads in given Context.

listThreads(contextId, pagingQuery)

NameTypeDescription
contextIdstringID of the Context to get the Threads from
pagingQueryPagingQuerystruct with list query parameters

TypeDescription
Promise<PagingList<Thread>> struct containing a list of Threads

getMessage

Gets a message by given message ID.

getMessage(messageId)

NameTypeDescription
messageIdstringID of the message to get

TypeDescription
Promise<Message> struct containing the message

listMessages

Gets a list of messages from a Thread.

listMessages(threadId, pagingQuery)

NameTypeDescription
threadIdstringID of the Thread to list messages from
pagingQueryPagingQuerystruct with list query parameters

TypeDescription
Promise<PagingList<Message>> struct containing a list of messages

sendMessage

Sends a message in a Thread.

sendMessage(threadId, publicMeta, privateMeta, data)

NameTypeDescription
threadIdstringID of the Thread to send message to
publicMetaUint8Arraypublic message metadata
privateMetaUint8Arrayprivate message metadata
dataUint8Arraycontent of the message

TypeDescription
Promise<string> ID of the new message

deleteMessage

Deletes a message by given message ID.

deleteMessage(messageId)

NameTypeDescription
messageIdstringID of the message to delete

updateMessage

Update message in a Thread.

updateMessage(messageId, publicMeta, privateMeta, data)

NameTypeDescription
messageIdstringID of the message to update
publicMetaUint8Arraypublic message metadata
privateMetaUint8Arrayprivate message metadata
dataUint8Arraycontent of the message

subscribeForThreadEvents

Subscribes for the Thread module main events.

subscribeForThreadEvents()

unsubscribeFromThreadEvents

Unsubscribes from the Thread module main events.

unsubscribeFromThreadEvents()

subscribeForMessageEvents

Subscribes for events in given Thread.

subscribeForMessageEvents(threadId)

NameTypeDescription
threadIdstringID of the Thread to subscribe

unsubscribeFromMessageEvents

Unsubscribes from events in given Thread.

unsubscribeFromMessageEvents(threadId)

NameTypeDescription
threadIdstringID of the Thread to unsubscribe