Skip to main content
reference

ThreadApi

Manages Threads and messages.

Constructors

ThreadApi

Initialize Thread module on given active connection.

public void ThreadApi(
Connection connection
)

NameTypeDescription
connectionConnectionactive connection to PrivMX Bridge

Methods

close

Frees memory.

public void close()

createThread

Creates a new Thread in given Context.

public String createThread(
String contextId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta
)

NameTypeDescription
contextIdStringID of the Context to create the Thread in
usersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access to the created Thread
managersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access (and management rights) to the created Thread
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata

TypeDescription
String ID of the created Thread

deleteMessage

Deletes a message by given message ID.

public void deleteMessage(
String messageId
)

NameTypeDescription
messageIdStringID of the message to delete

deleteThread

Deletes a Thread by given Thread ID.

public void deleteThread(
String threadId
)

NameTypeDescription
threadIdStringID of the Thread to delete

getMessage

Gets a message by given message ID.

public Message getMessage(
String messageId
)

NameTypeDescription
messageIdStringID of the message to get

TypeDescription
Message Message with matching id

getThread

Gets a Thread by given Thread ID.

public Thread getThread(
String threadId
)

NameTypeDescription
threadIdStringID of Thread to get

TypeDescription
Thread Information about the Thread

listMessages

Gets a list of messages from a Thread.

public PagingList<Message> listMessages(
String threadId,
long skip,
long limit,
String sortOrder
)

NameTypeDescription
threadIdStringID of the Thread to list messages from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)

TypeDescription
PagingList<Message> list of messages

listMessages

Gets a list of messages from a Thread.

public PagingList<Message> listMessages(
String threadId,
long skip,
long limit,
String sortOrder,
String lastId
)

NameTypeDescription
threadIdStringID of the Thread to list messages from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)
lastIdStringID of the element from which query results should start

TypeDescription
PagingList<Message> list of messages

listThreads

Gets a list of Threads in given Context.

public PagingList<Thread> listThreads(
String contextId,
long skip,
long limit,
String sortOrder
)

NameTypeDescription
contextIdStringID of the Context to get the Threads from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)

TypeDescription
PagingList<Thread> list of Threads

listThreads

Gets a list of Threads in given Context.

public PagingList<Thread> listThreads(
String contextId,
long skip,
long limit,
String sortOrder,
String lastId
)

NameTypeDescription
contextIdStringID of the Context to get the Threads from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)
lastIdStringID of the element from which query results should start

TypeDescription
PagingList<Thread> list of Threads

sendMessage

Sends a message in a Thread.

public String sendMessage(
String threadId,
byte[] publicMeta,
byte[] privateMeta,
byte[] data
)

NameTypeDescription
threadIdStringID of the Thread to send message to
publicMetabyte[]public message metadata
privateMetabyte[]private message metadata
databyte[]content of the message

TypeDescription
String ID of the new message

subscribeForMessageEvents

Subscribes for events in given Thread.

public void subscribeForMessageEvents(
String threadId
)

NameTypeDescription
threadIdStringID of the Thread to subscribe

subscribeForThreadEvents

Subscribes for the Thread module main events.

public void subscribeForThreadEvents()

unsubscribeFromMessageEvents

Unsubscribes from events in given Thread.

public void unsubscribeFromMessageEvents(
String threadId
)

NameTypeDescription
threadIdStringID of the Thread to unsubscribe

unsubscribeFromThreadEvents

Unsubscribes from the Thread module main events.

public void unsubscribeFromThreadEvents()

updateMessage

Updates message in a Thread.

public void updateMessage(
String messageId,
byte[] publicMeta,
byte[] privateMeta,
byte[] data
)

NameTypeDescription
messageIdStringID of the message to update
publicMetabyte[]public message metadata
privateMetabyte[]private message metadata
databyte[]new content of the message

updateThread

Updates an existing Thread.

public void updateThread(
String threadId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
long version,
boolean force
)

NameTypeDescription
threadIdStringID of the Thread to update
usersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access to the updated Thread
managersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access (and management rights) to the updated Thread
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata
versionlongcurrent version of the updated Thread
forcebooleanforce update (without checking version)

updateThread

Updates an existing Thread.

public void updateThread(
String threadId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
long version,
boolean force,
boolean forceGenerateNewKey
)

NameTypeDescription
threadIdStringID of the Thread to update
usersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access to the updated Thread
managersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access (and management rights) to the updated Thread
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata
versionlongcurrent version of the updated Thread
forcebooleanforce update (without checking version)
forceGenerateNewKeybooleanforce to regenerate a key for the Thread