ChatThreadAsyncClient Class

  • java.lang.Object
    • com.azure.communication.chat.ChatThreadAsyncClient

public final class ChatThreadAsyncClient

Async Client that supports chat thread operations.

Instantiating an asynchronous Chat Thread Client

Java
// Initialize the chat client builder
 final ChatClientBuilder builder = new ChatClientBuilder()
     .endpoint(endpoint)
     .credential(credential);

 // Build the chat client
 ChatAsyncClient chatClient = builder.buildAsyncClient();

 // Get the chat thread client for your thread's id
 ChatThreadAsyncClient chatThreadClient = chatClient.getChatThreadClient(threadId);

View ChatClientBuilder for additional ways to construct the client.

Method Summary

Modifier and Type Method and Description
Mono<Void> addParticipant(ChatParticipant participant)

Adds a participant to a thread.

Mono<AddChatParticipantsResult> addParticipants(Iterable<ChatParticipant> participants)

Adds participants to a thread.

Mono<Response<AddChatParticipantsResult>> addParticipantsWithResponse(Iterable<ChatParticipant> participants)

Adds participants to a thread.

Mono<Response<Void>> addParticipantWithResponse(ChatParticipant participant)

Adds a participant to a thread.

Mono<Void> deleteMessage(String chatMessageId)

Deletes a message.

Mono<Response<Void>> deleteMessageWithResponse(String chatMessageId)

Deletes a message.

String getChatThreadId()

Get the thread id property.

Mono<ChatMessage> getMessage(String chatMessageId)

Gets a message by id.

Mono<Response<ChatMessage>> getMessageWithResponse(String chatMessageId)

Gets a message by id.

Mono<ChatThreadProperties> getProperties()

Gets chat thread properties.

Mono<Response<ChatThreadProperties>> getPropertiesWithResponse()

Gets chat thread properties.

PagedFlux<ChatMessage> listMessages()

Gets a list of messages from a thread.

PagedFlux<ChatMessage> listMessages(ListChatMessagesOptions listMessagesOptions)

Gets a list of messages from a thread.

PagedFlux<ChatParticipant> listParticipants()

Gets the participants of a thread.

PagedFlux<ChatParticipant> listParticipants(ListParticipantsOptions listParticipantsOptions)

Gets the participants of a thread.

PagedFlux<ChatMessageReadReceipt> listReadReceipts()

Gets read receipts for a thread.

PagedFlux<ChatMessageReadReceipt> listReadReceipts(ListReadReceiptOptions listReadReceiptOptions)

Gets read receipts for a thread.

Mono<Void> removeParticipant(CommunicationIdentifier identifier)

Remove a participant from a thread.

Mono<Response<Void>> removeParticipantWithResponse(CommunicationIdentifier identifier)

Remove a participant from a thread.

Mono<SendChatMessageResult> sendMessage(SendChatMessageOptions options)

Sends a message to a thread.

Mono<Response<SendChatMessageResult>> sendMessageWithResponse(SendChatMessageOptions options)

Sends a message to a thread.

Mono<Void> sendReadReceipt(String chatMessageId)

Posts a read receipt event to a thread, on behalf of a user.

Mono<Response<Void>> sendReadReceiptWithResponse(String chatMessageId)

Posts a read receipt event to a thread, on behalf of a user.

Mono<Void> sendTypingNotification()

Posts a typing event to a thread, on behalf of a user.

Mono<Response<Void>> sendTypingNotificationWithResponse()

Posts a typing event to a thread, on behalf of a user.

Mono<Response<Void>> sendTypingNotificationWithResponse(TypingNotificationOptions options)

Posts a typing event to a thread, on behalf of a user.

Mono<Void> updateMessage(String chatMessageId, UpdateChatMessageOptions options)

Updates a message.

Mono<Response<Void>> updateMessageWithResponse(String chatMessageId, UpdateChatMessageOptions options)

Updates a message.

Mono<Void> updateTopic(String topic)

Updates a thread's topic.

Mono<Response<Void>> updateTopicWithResponse(String topic)

Updates a thread's properties.

Methods inherited from java.lang.Object

Method Details

addParticipant

public Mono addParticipant(ChatParticipant participant)

Adds a participant to a thread. If the participant already exists, no change occurs.

Parameters:

participant - The new participant.

Returns:

nothing.

addParticipants

public Mono addParticipants(Iterable participants)

Adds participants to a thread. If participants already exist, no change occurs.

Parameters:

participants - Collection of participants to add.

Returns:

the result.

addParticipantsWithResponse

public Mono> addParticipantsWithResponse(Iterable participants)

Adds participants to a thread. If participants already exist, no change occurs.

Parameters:

participants - Collection of participants to add.

Returns:

the result.

addParticipantWithResponse

public Mono> addParticipantWithResponse(ChatParticipant participant)

Adds a participant to a thread. If the participant already exists, no change occurs.

Parameters:

participant - The new participant.

Returns:

the response.

deleteMessage

public Mono deleteMessage(String chatMessageId)

Deletes a message.

Parameters:

chatMessageId - The message id.

Returns:

the completion.

deleteMessageWithResponse

public Mono> deleteMessageWithResponse(String chatMessageId)

Deletes a message.

Parameters:

chatMessageId - The message id.

Returns:

the completion.

getChatThreadId

public String getChatThreadId()

Get the thread id property.

Returns:

the thread id value.

getMessage

public Mono getMessage(String chatMessageId)

Gets a message by id.

Parameters:

chatMessageId - The message id.

Returns:

a message by id.

getMessageWithResponse

public Mono> getMessageWithResponse(String chatMessageId)

Gets a message by id.

Parameters:

chatMessageId - The message id.

Returns:

a message by id.

getProperties

public Mono getProperties()

Gets chat thread properties.

Returns:

chat thread properties.

getPropertiesWithResponse

public Mono> getPropertiesWithResponse()

Gets chat thread properties.

Returns:

chat thread properties.

listMessages

public PagedFlux listMessages()

Gets a list of messages from a thread.

Returns:

a paged list of messages from a thread.

listMessages

public PagedFlux listMessages(ListChatMessagesOptions listMessagesOptions)

Gets a list of messages from a thread.

Parameters:

listMessagesOptions - The request options.

Returns:

a paged list of messages from a thread.

listParticipants

public PagedFlux listParticipants()

Gets the participants of a thread.

Returns:

the participants of a thread.

listParticipants

public PagedFlux listParticipants(ListParticipantsOptions listParticipantsOptions)

Gets the participants of a thread.

Parameters:

listParticipantsOptions - The request options.

Returns:

the participants of a thread.

listReadReceipts

public PagedFlux listReadReceipts()

Gets read receipts for a thread.

Returns:

read receipts for a thread.

listReadReceipts

public PagedFlux listReadReceipts(ListReadReceiptOptions listReadReceiptOptions)

Gets read receipts for a thread.

Parameters:

listReadReceiptOptions - The additional options for this operation.

Returns:

read receipts for a thread.

removeParticipant

public Mono removeParticipant(CommunicationIdentifier identifier)

Remove a participant from a thread.

Parameters:

identifier - Identity of the participant to remove from the thread.

Returns:

the completion.

removeParticipantWithResponse

public Mono> removeParticipantWithResponse(CommunicationIdentifier identifier)

Remove a participant from a thread.

Parameters:

identifier - Identity of the participant to remove from the thread.

Returns:

the completion.

sendMessage

public Mono sendMessage(SendChatMessageOptions options)

Sends a message to a thread.

Code Samples

Send a chat message based on "options".

Java
// Set the chat message options
 SendChatMessageOptions sendChatMessageOptions = new SendChatMessageOptions()
     .setContent("Message content")
     .setSenderDisplayName("Sender Display Name");

 // Get the request result and the chat message id
 SendChatMessageResult sendResult = chatThreadClient.sendMessage(sendChatMessageOptions).block();
 String messageId = sendResult.getId();

Parameters:

options - Options for sending the message.

Returns:

the SendChatMessageResult.

sendMessageWithResponse

public Mono> sendMessageWithResponse(SendChatMessageOptions options)

Sends a message to a thread.

Parameters:

options - Options for sending the message.

Returns:

the SendChatMessageResult.

sendReadReceipt

public Mono sendReadReceipt(String chatMessageId)

Posts a read receipt event to a thread, on behalf of a user.

Parameters:

chatMessageId - The id of the chat message that was read.

Returns:

the completion.

sendReadReceiptWithResponse

public Mono> sendReadReceiptWithResponse(String chatMessageId)

Posts a read receipt event to a thread, on behalf of a user.

Parameters:

chatMessageId - The id of the chat message that was read.

Returns:

the completion.

sendTypingNotification

public Mono sendTypingNotification()

Posts a typing event to a thread, on behalf of a user.

Returns:

the completion.

sendTypingNotificationWithResponse

public Mono> sendTypingNotificationWithResponse()

Posts a typing event to a thread, on behalf of a user.

Returns:

the completion.

sendTypingNotificationWithResponse

public Mono> sendTypingNotificationWithResponse(TypingNotificationOptions options)

Posts a typing event to a thread, on behalf of a user.

Parameters:

options - Options for sending the typing notification.

Returns:

the completion.

updateMessage

public Mono updateMessage(String chatMessageId, UpdateChatMessageOptions options)

Updates a message.

Parameters:

chatMessageId - The message id.
options - Options for updating the message.

Returns:

the completion.

updateMessageWithResponse

public Mono> updateMessageWithResponse(String chatMessageId, UpdateChatMessageOptions options)

Updates a message.

Parameters:

chatMessageId - The message id.
options - Options for updating the message.

Returns:

the completion.

updateTopic

public Mono updateTopic(String topic)

Updates a thread's topic.

Parameters:

topic - The new topic.

Returns:

the completion.

updateTopicWithResponse

public Mono> updateTopicWithResponse(String topic)

Updates a thread's properties.

Parameters:

topic - The new topic.

Returns:

the completion.

Applies to

Azure SDK for Java

Latest