Skip to content

Commit ec5c4d1

Browse files
juancamilorCamilo Ramirez
andauthored
Azure review - renaming for GA (Azure#16989)
* Azure review for GA: Use same terminology than calling (Participant instead of Member) Use UpdateTopic instead of UpdateThread in operation name Use ChatMessageReadReceipt instead of ReadReceipt in model name Return messageId instead of SendMessageResult. (SendMessage operation) Add convenience method to add 1 member All details : https://skype.visualstudio.com/DefaultCollection/SPOOL/_workitems/edit/2235800 Co-authored-by: Camilo Ramirez <juramir@microsoft.com>
1 parent 8153513 commit ec5c4d1

File tree

59 files changed

+4984
-8726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4984
-8726
lines changed

sdk/communication/Azure.Communication.Chat/README.md

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Azure Communication Chat client library for .NET
22

3-
> Server Version:
4-
Chat client: 2020-09-21-preview2
3+
> Server - Chat Api Version: 2020-11-01-preview3
4+
> Client - Chat SDK Version: 1.0.0-beta.3
55
66
This package contains a C# SDK for Azure Communication Services for chat.
77

@@ -54,19 +54,19 @@ ChatClient chatClient = new ChatClient(
5454

5555
### Create a ChatThreadClient
5656

57-
The ChatThreadClient will allow you to perform operations specific to a chat thread, like update the chat thread topic, send a message, add members to the chat thread, etc.
57+
The ChatThreadClient will allow you to perform operations specific to a chat thread, like update the chat thread topic, send a message, add participants to the chat thread, etc.
5858

5959
You can instantiate a new ChatThreadClient instance using the ChatClient:
6060

6161
```C# Snippet:Azure_Communication_Chat_Tests_E2E_InitializeChatThreadClient
62-
ChatThreadClient chatThreadClient1 = chatClient.CreateChatThread("Thread topic", members);
62+
ChatThreadClient chatThreadClient1 = chatClient.CreateChatThread("Thread topic", participants);
6363
// Alternatively, if you have created a chat thread before and you have its threadId, you can create a ChatThreadClient instance using:
6464
ChatThreadClient chatThreadClient2 = chatClient.GetChatThreadClient("threadId");
6565
```
6666

6767
## Key concepts
6868

69-
A chat conversation is represented by a thread. Each user in the thread is called a thread member. Thread members can chat with one another privately in a 1:1 chat or huddle up in a 1:N group chat. Users also get near-real time updates for when others are typing and when they have read the messages.
69+
A chat conversation is represented by a thread. Each user in the thread is called a thread participant. Thread participants can chat with one another privately in a 1:1 chat or huddle up in a 1:N group chat. Users also get near-real time updates for when others are typing and when they have read the messages.
7070

7171
Once you initialized a `ChatClient` class, you can do the following chat operations:
7272

@@ -91,12 +91,12 @@ Once you initialized a `ChatThreadClient` class, you can do the following chat o
9191
### Update a thread
9292

9393
```C# Snippet:Azure_Communication_Chat_Tests_E2E_UpdateThread
94-
chatThreadClient.UpdateThread(topic: "Launch meeting");
94+
chatThreadClient.UpdateTopic(topic: "Launch meeting");
9595
```
9696

9797
### Send a message
9898
```C# Snippet:Azure_Communication_Chat_Tests_E2E_SendMessage
99-
SendChatMessageResult sendChatMessageResult = chatThreadClient.SendMessage("Let's meet at 11am");
99+
string messageId = chatThreadClient.SendMessage("Let's meet at 11am");
100100
```
101101
### Update a message
102102
```C# Snippet:Azure_Communication_Chat_Tests_E2E_UpdateMessage
@@ -114,25 +114,25 @@ Pageable<ChatMessage> messages = chatThreadClient.GetMessages();
114114
```C# Snippet:Azure_Communication_Chat_Tests_E2E_DeleteMessage
115115
chatThreadClient.DeleteMessage(messageId);
116116
```
117-
### Get a list of members
118-
```C# Snippet:Azure_Communication_Chat_Tests_E2E_GetMembers
119-
Pageable<ChatThreadMember> chatThreadMembers = chatThreadClient.GetMembers();
117+
### Get a list of participants
118+
```C# Snippet:Azure_Communication_Chat_Tests_E2E_GetParticipants
119+
Pageable<ChatParticipant> chatParticipants = chatThreadClient.GetParticipants();
120120
```
121-
### Add members
122-
```C# Snippet:Azure_Communication_Chat_Tests_E2E_AddMembers
123-
chatThreadClient.AddMembers(members: new[] { newMember });
121+
### Add participants
122+
```C# Snippet:Azure_Communication_Chat_Tests_E2E_AddParticipants
123+
chatThreadClient.AddParticipants(participants: new[] { newParticipant });
124124
```
125-
### Remove a member
126-
```C# Snippet:Azure_Communication_Chat_Tests_E2E_RemoveMember
127-
chatThreadClient.RemoveMember(user: memberToBeRemoved);
125+
### Remove a participant
126+
```C# Snippet:Azure_Communication_Chat_Tests_E2E_RemoveParticipant
127+
chatThreadClient.RemoveParticipant(user: participantToBeRemoved);
128128
```
129129
### Send a typing notification
130130
```C# Snippet:Azure_Communication_Chat_Tests_E2E_SendTypingNotification
131131
chatThreadClient.SendTypingNotification();
132132
```
133133
### Get a list of read receipts
134134
```C# Snippet:Azure_Communication_Chat_Tests_E2E_GetReadReceipts
135-
Pageable<ReadReceipt> readReceipts = chatThreadClient.GetReadReceipts();
135+
Pageable<ChatMessageReadReceipt> readReceipts = chatThreadClient.GetReadReceipts();
136136
```
137137
### Send a read receipt
138138
```C# Snippet:Azure_Communication_Chat_Tests_E2E_SendReadReceipt
@@ -144,7 +144,7 @@ The following sections provide several code snippets covering some of the most c
144144

145145
- [Thread Operations](#thread-operations)
146146
- [Message Operations](#message-operations)
147-
- [Thread Member Operations](#thread-member-operations)
147+
- [Thread Participant Operations](#thread-participant-operations)
148148
- [Events Operations](#events-operations)
149149

150150
## Thread Operations
@@ -153,26 +153,26 @@ The following sections provide several code snippets covering some of the most c
153153

154154
Use `CreateChatThread` to create a chat thread client object.
155155
- Use `topic` to give a thread topic.
156-
- The following are the supported attributes for each thread member:
157-
- `communicationUser`, required, it is the identification for the thread member.
158-
- `displayName`, optional, is the display name for the thread member
159-
- `shareHistoryTime`, optional, time from which the chat history is shared with the member.
156+
- The following are the supported attributes for each thread participant:
157+
- `communicationUser`, required, it is the identification for the thread participant.
158+
- `displayName`, optional, is the display name for the thread participant
159+
- `shareHistoryTime`, optional, time from which the chat history is shared with the participant.
160160

161161
`ChatThreadClient` is the result returned from creating a thread, you can use it to perform other operations on the chat thread.
162162

163-
**Important:** Make sure the user creating the chat thread is explicitely added to the list of members, otherwise the creation call will fail.
163+
**Important:** Make sure the user creating the chat thread is explicitely added to the list of participants, otherwise the creation call will fail.
164164

165165
```C# Snippet:Azure_Communication_Chat_Tests_Samples_CreateChatClient
166166
ChatClient chatClient = new ChatClient(
167167
new Uri(endpoint),
168168
new CommunicationUserCredential(userToken));
169169
```
170170
```C# Snippet:Azure_Communication_Chat_Tests_Samples_CreateThread
171-
var chatThreadMember = new ChatThreadMember(new CommunicationUser(threadCreatorId))
171+
var chatParticipant = new ChatParticipant(threadCreator)
172172
{
173173
DisplayName = "UserDisplayName"
174174
};
175-
ChatThreadClient chatThreadClient = await chatClient.CreateChatThreadAsync(topic: "Hello world!", members: new[] { chatThreadMember });
175+
ChatThreadClient chatThreadClient = await chatClient.CreateChatThreadAsync(topic: "Hello world!", participants: new[] { chatParticipant });
176176
string threadId = chatThreadClient.Id;
177177
```
178178
### Get a thread
@@ -184,9 +184,9 @@ Use `GetChatThread` to retrieve a chat thread from the service.
184184
ChatThread chatThread = await chatClient.GetChatThreadAsync(threadId);
185185
```
186186

187-
### Get threads (for a member)
187+
### Get threads (for a participant)
188188

189-
Use `GetChatThreadsInfo` to get the list of chat threads for the member that instantiated the chatClient.
189+
Use `GetChatThreadsInfo` to get the list of chat threads for the participant that instantiated the chatClient.
190190

191191
```C# Snippet:Azure_Communication_Chat_Tests_Samples_GetThreads
192192
AsyncPageable<ChatThreadInfo> chatThreadsInfo = chatClient.GetChatThreadsInfoAsync();
@@ -207,12 +207,12 @@ await chatClient.DeleteChatThreadAsync(threadId);
207207

208208
### Update a thread
209209

210-
Use `UpdateChatThread` to update the chat thread properties.
210+
Use `UpdateTopic` to update the chat thread topic.
211211
- `topic` is used to describe the updated topic for the thread.
212212

213213
```C# Snippet:Azure_Communication_Chat_Tests_Samples_UpdateThread
214214
var topic = "new topic";
215-
await chatThreadClient.UpdateThreadAsync(topic);
215+
await chatThreadClient.UpdateTopicAsync(topic);
216216
```
217217

218218
## Message Operations
@@ -231,7 +231,7 @@ Use `SendMessage` to send a message to a thread.
231231
var content = "hello world";
232232
var priority = ChatMessagePriority.Normal;
233233
var senderDisplayName = "sender name";
234-
SendChatMessageResult sendMessageResult = await chatThreadClient.SendMessageAsync(content, priority, senderDisplayName);
234+
var messageId = await chatThreadClient.SendMessageAsync(content, priority, senderDisplayName);
235235
```
236236
### Get a message
237237

@@ -272,43 +272,44 @@ Use `DeleteMessage` to delete a message.
272272
await chatThreadClient.DeleteMessageAsync(messageId);
273273
```
274274

275-
## Thread Member Operations
275+
## Thread Participant Operations
276276

277-
### Get thread members
277+
### Get thread participants
278278

279-
Use `GetMembers` to retrieve the members of the chat thread.
279+
Use `GetParticipants` to retrieve the participants of the chat thread.
280280

281-
```C# Snippet:Azure_Communication_Chat_Tests_Samples_GetMembers
282-
AsyncPageable<ChatThreadMember> allMembers = chatThreadClient.GetMembersAsync();
283-
await foreach (ChatThreadMember member in allMembers)
281+
```C# Snippet:Azure_Communication_Chat_Tests_Samples_GetParticipants
282+
AsyncPageable<ChatParticipant> allParticipants = chatThreadClient.GetParticipantsAsync();
283+
await foreach (ChatParticipant participant in allParticipants)
284284
{
285-
Console.WriteLine($"{member.User.Id}:{member.DisplayName}:{member.ShareHistoryTime}");
285+
Console.WriteLine($"{participant.User.Id}:{participant.DisplayName}:{participant.ShareHistoryTime}");
286286
}
287287
```
288-
### Add thread members
288+
### Add thread participants
289289

290-
Use `AddMembers` to add members to the chat thread. The following are the supported attributes for each thread member:
291-
- `communicationUser`, required, it is the identification for the thread member.
292-
- `displayName`, optional, is the display name for the thread member.
293-
- `shareHistoryTime`, optional, time from which the chat history is shared with the member.
290+
Use `AddParticipants` to add one or more participants to the chat thread. The following are the supported attributes for each thread participant(s):
291+
- `communicationUser`, required, it is the identification for the thread participant.
292+
- `displayName`, optional, is the display name for the thread participant.
293+
- `shareHistoryTime`, optional, time from which the chat history is shared with the participant.
294294

295-
```C# Snippet:Azure_Communication_Chat_Tests_Samples_AddMembers
296-
var members = new[]
295+
```C# Snippet:Azure_Communication_Chat_Tests_Samples_AddParticipants
296+
var participants = new[]
297297
{
298-
new ChatThreadMember(new CommunicationUser(memberId1)) { DisplayName ="display name member 1"},
299-
new ChatThreadMember(new CommunicationUser(memberId2)) { DisplayName ="display name member 2"},
300-
new ChatThreadMember(new CommunicationUser(memberId3)) { DisplayName ="display name member 3"}
298+
new ChatParticipant(josh) { DisplayName ="Josh"},
299+
new ChatParticipant(gloria) { DisplayName ="Gloria"},
300+
new ChatParticipant(amy) { DisplayName ="Amy"}
301301
};
302-
await chatThreadClient.AddMembersAsync(members);
302+
303+
await chatThreadClient.AddParticipantsAsync(participants);
303304
```
304305

305-
### Remove thread member
306+
### Remove thread participant
306307

307-
Use `RemoveMember` to remove a thread member from the thread.
308-
`communicationUser` is the identification of the chat member.
308+
Use `RemoveParticipant` to remove a thread participant from the thread.
309+
`communicationUser` is the identification of the chat participant.
309310

310-
```C# Snippet:Azure_Communication_Chat_Tests_Samples_RemoveMember
311-
await chatThreadClient.RemoveMemberAsync(new CommunicationUser(memberId));
311+
```C# Snippet:Azure_Communication_Chat_Tests_Samples_RemoveParticipant
312+
await chatThreadClient.RemoveParticipantAsync(gloria);
312313
```
313314

314315
## Events Operations
@@ -323,19 +324,19 @@ await chatThreadClient.SendTypingNotificationAsync();
323324

324325
### Send read receipt
325326

326-
Use `SendReadReceipt` to notify other members that the message is read by the user.
327+
Use `SendReadReceipt` to notify other participants that the message is read by the user.
327328

328329
```C# Snippet:Azure_Communication_Chat_Tests_Samples_SendReadReceipt
329330
await chatThreadClient.SendReadReceiptAsync(messageId);
330331
```
331332

332333
### Get read receipts
333334

334-
Use `GetReadReceipts` to check the status of messages to see which ones are read by other members of a chat thread.
335+
Use `GetReadReceipts` to check the status of messages to see which ones are read by other participants of a chat thread.
335336

336337
```C# Snippet:Azure_Communication_Chat_Tests_Samples_GetReadReceipts
337-
AsyncPageable<ReadReceipt> allReadReceipts = chatThreadClient.GetReadReceiptsAsync();
338-
await foreach (ReadReceipt readReceipt in allReadReceipts)
338+
AsyncPageable<ChatMessageReadReceipt> allReadReceipts = chatThreadClient.GetReadReceiptsAsync();
339+
await foreach (ChatMessageReadReceipt readReceipt in allReadReceipts)
339340
{
340341
Console.WriteLine($"{readReceipt.ChatMessageId}:{readReceipt.Sender.Id}:{readReceipt.ReadOn}");
341342
}
@@ -347,7 +348,7 @@ A `RequestFailedException` is thrown as a service response for any unsuccessful
347348
```C# Snippet:Azure_Communication_Chat_Tests_Samples_Troubleshooting
348349
try
349350
{
350-
ChatThreadClient chatThreadClient_ = await chatClient.CreateChatThreadAsync(topic: "Hello world!", members: new[] { chatThreadMember });
351+
ChatThreadClient chatThreadClient_ = await chatClient.CreateChatThreadAsync(topic: "Hello world!", participants: new[] { josh });
351352
}
352353
catch (RequestFailedException ex)
353354
{

0 commit comments

Comments
 (0)