PrivMX DOCS
API Reference/PrivMX Endpoint C# Extra/Threads

AsyncThreadApi

Asynchronous wrapper over thread API.

Methods

AsyncThreadApi

Creates async thread API over real PrivMX connection.

Params

connection

Connection

Connection used.

AsyncThreadApi(
Connection connection
)

AsyncThreadApi

Wraps existing thread api into async thread api. This constructor is meant to be used in advanced scenarios like object mocking and testing.

Params

threadApi

IThreadApi

Existing thread API.

connectionId

long

ID of user connection.

eventDispatcher

IEventDispatcher

Event dispatcher used as event source.

AsyncThreadApi(
IThreadApi threadApi,
long connectionId,
IEventDispatcher eventDispatcher
)

DisposeAsync

Disposes async thread API with all related resources.

ValueTask DisposeAsync()

Returns

ValueTask ·

CreateThreadAsync

Creates new Thread in given Context.

Params

contextId

string

ID of the Context to create the Thread in.

users

List<UserWithPubKey>

Array of UserWithPubKey which indicates who will have access to the created Thread.

managers

List<UserWithPubKey>

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

publicMeta

byte[]

Public (unencrypted) meta data.

privateMeta

byte[]

Private (encrypted) meta data.

policies

ContainerPolicy?

(optional) Thread policy.

token

CancellationToken

Cancellation token.

ValueTask<string> CreateThreadAsync(
string contextId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
ContainerPolicy? policies = null,
CancellationToken token = default
)

Returns

ValueTask<string> · ID of the created Thread.

UpdateThreadAsync

Updates an existing Thread.

Params

threadId

string

ID of the Thread to update.

users

List<UserWithPubKey>

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

managers

List<UserWithPubKey>

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

publicMeta

byte[]

Public (unencrypted) meta data.

privateMeta

byte[]

Private (encrypted) meta data.

version

long

Current version of the updated Thread.

force

bool

Force update (without checking version).

forceGenerateNewKey

bool

Force to regenerate a key for the Thread.

policies

ContainerPolicy?

(optional) Thread policy.

token

CancellationToken

Cancellation token.

ValueTask UpdateThreadAsync(
string threadId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
long version,
bool force,
bool forceGenerateNewKey,
ContainerPolicy? policies = null,
CancellationToken token = default
)

Returns

ValueTask ·

DeleteThreadAsync

Deletes a Thread by given Thread ID.

Params

threadId

string

ID of the Thread to delete.

token

CancellationToken

Cancellation token.

ValueTask DeleteThreadAsync(
string threadId,
CancellationToken token = default
)

Returns

ValueTask ·

GetThreadAsync

Gets a Thread by given Thread ID.

Params

threadId

string

ID of Thread to get.

token

CancellationToken

Cancellation token

ValueTask<Thread> GetThreadAsync(
string threadId,
CancellationToken token = default
)

Returns

ValueTask<Thread> · Information about the Thread.

ListThreadsAsync

Gets a list of Threads in given Context.

Params

contextId

string

ID of the Context to get the Threads from.

pagingQuery

PagingQuery

List query parameters.

token

CancellationToken

Cancellation token.

ValueTask<PagingList<Thread>> ListThreadsAsync(
string contextId,
PagingQuery pagingQuery,
CancellationToken token = default
)

Returns

ValueTask<PagingList<Thread>> · List of Threads.

GetMessageAsync

Gets a message by given message ID.

Params

messageId

string

ID of the message to get.

token

CancellationToken

Cancellation token.

ValueTask<Message> GetMessageAsync(
string messageId,
CancellationToken token = default
)

Returns

ValueTask<Message> · Message.

ListMessagesAsync

Gets a list of messages from a Thread.

Params

threadId

string

ID of the Thread to list messages from.

pagingQuery

PagingQuery

List query parameters.

token

CancellationToken

Cancellation token.

ValueTask<PagingList<Message>> ListMessagesAsync(
string threadId,
PagingQuery pagingQuery,
CancellationToken token = default
)

Returns

ValueTask<PagingList<Message>> · List of messages.

SendMessageAsync

Sends a message in a Thread.

Params

threadId

string

ID of the Thread to send message to.

publicMeta

byte[]

Public message metadata.

privateMeta

byte[]

Private message metadata.

data

byte[]

Content of the message.

token

CancellationToken

Cancellation token.

ValueTask<string> SendMessageAsync(
string threadId,
byte[] publicMeta,
byte[] privateMeta,
byte[] data,
CancellationToken token = default
)

Returns

ValueTask<string> · ID of the new message.

UpdateMessageAsync

Updates a message in a Thread.

Params

messageId

string

ID of the message to update.

publicMeta

byte[]

Public message metadata.

privateMeta

byte[]

Private message metadata.

data

byte[]

Content of the message.

token

CancellationToken

Cancellation token.

ValueTask UpdateMessageAsync(
string messageId,
byte[] publicMeta,
byte[] privateMeta,
byte[] data,
CancellationToken token = default
)

Returns

ValueTask ·

DeleteMessageAsync

Deletes a message by given message ID.

Params

messageId

string

ID of the message to delete.

token

CancellationToken

Cancellation token.

ValueTask DeleteMessageAsync(
string messageId,
CancellationToken token = default
)

Returns

ValueTask ·

GetThreadEvents

Stream of threads related events.

IObservable<ThreadEvent> GetThreadEvents()

Returns

IObservable<ThreadEvent> · Observable stream of events.

GetThreadMessageEvents

Stream of events related to a particular thread.

Params

threadId

string

ID of the thread.

IObservable<ThreadMessageEvent> GetThreadMessageEvents(
string threadId
)

Returns

IObservable<ThreadMessageEvent> · Observable stream of events.

Dispose

Dispose async thread API with all related resources.

void Dispose()

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.