From ea13ae2dec34f2408b7b3cd7ae309e47106c0ae9 Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Mon, 8 Feb 2021 18:56:35 -0800 Subject: [PATCH 1/7] [communication] prep release for common, identity, chat --- .../Azure.Communication.Chat/CHANGELOG.md | 22 +++++++++++++------ .../Azure.Communication.Common/CHANGELOG.md | 11 +++++----- .../Azure.Communication.Identity/CHANGELOG.md | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md index 0ffc1a5179703..6685cac3bf4af 100644 --- a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md @@ -1,13 +1,21 @@ # Release History -## 1.0.0-beta.4 (2021-02-08) -# Breaking -- Support for CreateChatThreadResult and AddChatParticipantsResult to handle partial errors in batch calls. +## 1.0.0-beta.4 (2021-02-09) + +### Breaking Changes + +- Replaced `CommunicationUser` with `CommunicationUserIdentifier`. +- Replaced `CommunicationUserCredential` with `CommunicationTokenCredential`. +- Removed `Priority` field from `ChatMessage`. + +### Added + +- Added support for `CreateChatThreadResult` and `AddChatParticipantsResult` to handle partial errors in batch calls. - Added idempotency identifier parameter for chat creation calls. -- Added support for readreceipts and getparticipants pagination. -- Added new model for messages anc ontent types : Text, Html, ParticipantAdded, ParticipantRemoved, TopicUpdated -- Removed priority field (ChatMessage.Priority) -- Added new model for errors (CommunicationError) +- Added pagination support for `GetReadReceipts`, `GetReadReceiptsAsync` and `GetParticipants`, `GetParticipantsAsync`. +- Added new model for messages and content types: `Text`, `Html`, `ParticipantAdded`, `ParticipantRemoved`, `TopicUpdated`. +- Added new model for errors (`CommunicationError`). +- Added notifications for thread level changes. ## 1.0.0-beta.3 (2020-11-16) diff --git a/sdk/communication/Azure.Communication.Common/CHANGELOG.md b/sdk/communication/Azure.Communication.Common/CHANGELOG.md index f62d2efd8bf47..ecbf560d090bc 100644 --- a/sdk/communication/Azure.Communication.Common/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.Common/CHANGELOG.md @@ -1,17 +1,18 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.4 (2021-02-09) ### Added - Added `MicrosoftTeamsUserIdentifier`. ### Breaking Changes - Renamed `CommunicationUserCredential` to `CommunicationTokenCredential`. -- Replace `CommunicationTokenCredential(bool refreshProactively, Func tokenRefresher,Func>? asyncTokenRefresher = null, string? initialToken = null)` +- Replaced `CommunicationTokenCredential(bool refreshProactively, Func tokenRefresher,Func>? asyncTokenRefresher = null, string? initialToken = null)`. with `CommunicationTokenCredential(CommunicationTokenRefreshOptions tokenRefreshOptions)`. -- Renamed `PhoneNumber` to `PhoneNumberIdentifier` -- Renamed `CommunicationUser` to `CommunicationUserIdentifier ` -- Renamed `CallingApplication` to `CallingApplicationIdentifier` +- Renamed `PhoneNumber` to `PhoneNumberIdentifier`. +- Renamed `CommunicationUser` to `CommunicationUserIdentifier`. +- Removed `CallingApplication`. +- Renamed `Id` to `RawId` in `PhoneNumberIdentifier`. ## 1.0.0-beta.3 (2020-11-16) Updated `Azure.Communication.Common` version. diff --git a/sdk/communication/Azure.Communication.Identity/CHANGELOG.md b/sdk/communication/Azure.Communication.Identity/CHANGELOG.md index 4afa5bccd8aad..8333494770945 100644 --- a/sdk/communication/Azure.Communication.Identity/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.Identity/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.4 (2021-02-09) ### Added - Added CommunicationIdentityClient (originally was part of the Azure.Communication.Administration package). From 551c75d67e75b883af8e6a60f2e6e65f75e79cbd Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 9 Feb 2021 09:37:43 -0800 Subject: [PATCH 2/7] update version numbers in READMEs --- .../Azure.Communication.Chat/README.md | 2 +- .../Azure.Communication.Common/README.md | 2 +- .../Azure.Communication.Identity/README.md | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sdk/communication/Azure.Communication.Chat/README.md b/sdk/communication/Azure.Communication.Chat/README.md index 86530b586fc28..d1ffdef2e791d 100644 --- a/sdk/communication/Azure.Communication.Chat/README.md +++ b/sdk/communication/Azure.Communication.Chat/README.md @@ -2,7 +2,7 @@ > Server - Chat Api Version: 2020-11-01-preview3 -> Client - Chat SDK Version: 1.0.0-beta.3 +> Client - Chat SDK Version: 1.0.0-beta.4 This package contains a C# SDK for Azure Communication Services for chat. diff --git a/sdk/communication/Azure.Communication.Common/README.md b/sdk/communication/Azure.Communication.Common/README.md index d5ab06e7ebc09..50917d652c18a 100644 --- a/sdk/communication/Azure.Communication.Common/README.md +++ b/sdk/communication/Azure.Communication.Common/README.md @@ -9,7 +9,7 @@ This package contains common code for Azure Communication Service libraries. Install the Azure Communication Common client library for .NET with [NuGet][nuget]. ```Powershell -dotnet add package Azure.Communication.Common --version 1.0.0-beta.3 +dotnet add package Azure.Communication.Common --version 1.0.0-beta.4 ``` ### Prerequisites diff --git a/sdk/communication/Azure.Communication.Identity/README.md b/sdk/communication/Azure.Communication.Identity/README.md index c7b4189d35c6b..f451d76c690ca 100644 --- a/sdk/communication/Azure.Communication.Identity/README.md +++ b/sdk/communication/Azure.Communication.Identity/README.md @@ -14,7 +14,7 @@ Azure Communication Identity is managing tokens for Azure Communication Services Install the Azure Communication Identity client library for .NET with [NuGet][nuget]: ```Powershell -dotnet add package Azure.Communication.Identity --version 1.0.0-beta.3 +dotnet add package Azure.Communication.Identity --version 1.0.0-beta.4 ``` ### Prerequisites @@ -41,7 +41,16 @@ var connectionString = ""; var client = new CommunicationIdentityClient(connectionString); ``` -Clients also have the option to authenticate using a valid token. +Or alternatively using the endpoint and access key acquired from an Azure Communication Resources in the [Azure Portal][azure_portal]. + +```C# Snippet:CreateCommunicationIdentityClient +// Get endpoint and access key for our Azure Communication resource. +var endpoint = ""; +var accessKey = ""; +var client = new CommunicationIdentityClient(new Uri(endpoint), new AzureKeyCredential(accessKey)); +``` + +Clients also have the option to authenticate using a valid Active Directory token. ```C# Snippet:CreateCommunicationIdentityFromToken var endpoint = new Uri("https://my-resource.communication.azure.com"); From 7bb7c0c3fada3c6f40e13beaebd1ab206061fedd Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 9 Feb 2021 09:58:41 -0800 Subject: [PATCH 3/7] fix accessKey sample --- .../Azure.Communication.Identity/README.md | 9 ++++--- .../Sample1_CommunicationIdentityClient.md | 10 +++++++- ...ample1_CommunicationIdentityClientAsync.md | 10 +++++++- .../Sample1_CommunicationIdentityClient.cs | 24 ++++++++++++++++++- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/sdk/communication/Azure.Communication.Identity/README.md b/sdk/communication/Azure.Communication.Identity/README.md index f451d76c690ca..ad4732be34598 100644 --- a/sdk/communication/Azure.Communication.Identity/README.md +++ b/sdk/communication/Azure.Communication.Identity/README.md @@ -43,11 +43,10 @@ var client = new CommunicationIdentityClient(connectionString); Or alternatively using the endpoint and access key acquired from an Azure Communication Resources in the [Azure Portal][azure_portal]. -```C# Snippet:CreateCommunicationIdentityClient -// Get endpoint and access key for our Azure Communication resource. -var endpoint = ""; -var accessKey = ""; -var client = new CommunicationIdentityClient(new Uri(endpoint), new AzureKeyCredential(accessKey)); +```C# Snippet:CreateCommunicationIdentityFromAccessKey +var endpoint = new Uri("https://my-resource.communication.azure.com"); +var accessKey = ""; +var client = new CommunicationIdentityClient(endpoint, new AzureKeyCredential(accessKey)); ``` Clients also have the option to authenticate using a valid Active Directory token. diff --git a/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClient.md b/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClient.md index bcec26c194a9c..58aa004b3f86f 100644 --- a/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClient.md +++ b/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClient.md @@ -18,7 +18,15 @@ var connectionString = ""; var client = new CommunicationIdentityClient(connectionString); ``` -Clients also have the option to authenticate using a valid token. +Or alternatively using the endpoint and access key acquired from an Azure Communication Resources in the [Azure Portal][azure_portal]. + +```C# Snippet:CreateCommunicationIdentityFromAccessKey +var endpoint = new Uri("https://my-resource.communication.azure.com"); +var accessKey = ""; +var client = new CommunicationIdentityClient(endpoint, new AzureKeyCredential(accessKey)); +``` + +Clients also have the option to authenticate using a valid Active Directory token. ```C# Snippet:CreateCommunicationIdentityFromToken var endpoint = new Uri("https://my-resource.communication.azure.com"); diff --git a/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClientAsync.md b/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClientAsync.md index 27d51ed212fb8..3c9beabc33397 100644 --- a/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClientAsync.md +++ b/sdk/communication/Azure.Communication.Identity/samples/Sample1_CommunicationIdentityClientAsync.md @@ -18,7 +18,15 @@ var connectionString = ""; var client = new CommunicationIdentityClient(connectionString); ``` -Clients also have the option to authenticate using a valid token. +Or alternatively using the endpoint and access key acquired from an Azure Communication Resources in the [Azure Portal][azure_portal]. + +```C# Snippet:CreateCommunicationIdentityFromAccessKey +var endpoint = new Uri("https://my-resource.communication.azure.com"); +var accessKey = ""; +var client = new CommunicationIdentityClient(endpoint, new AzureKeyCredential(accessKey)); +``` + +Clients also have the option to authenticate using a valid Active Directory token. ```C# Snippet:CreateCommunicationIdentityFromToken var endpoint = new Uri("https://my-resource.communication.azure.com"); diff --git a/sdk/communication/Azure.Communication.Identity/tests/samples/Sample1_CommunicationIdentityClient.cs b/sdk/communication/Azure.Communication.Identity/tests/samples/Sample1_CommunicationIdentityClient.cs index d68ad49abf3d2..08e1b647d99ba 100644 --- a/sdk/communication/Azure.Communication.Identity/tests/samples/Sample1_CommunicationIdentityClient.cs +++ b/sdk/communication/Azure.Communication.Identity/tests/samples/Sample1_CommunicationIdentityClient.cs @@ -113,6 +113,28 @@ public async Task CreateIdentityWithToken() } } + [Test] + public async Task CreateIdentityWithAccessKey() + { + #region Snippet:CreateCommunicationIdentityFromAccessKey + var endpoint = new Uri("https://my-resource.communication.azure.com"); + var accessKey = ""; + /*@@*/ endpoint = TestEnvironment.Endpoint; + /*@@*/ accessKey = TestEnvironment.AccessKey; + var client = new CommunicationIdentityClient(endpoint, new AzureKeyCredential(accessKey)); + #endregion Snippet:CreateCommunicationIdentityFromAccessKey + + client = CreateClientWithAzureKeyCredential(); + try + { + Response userResponse = await client.CreateUserAsync(); + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + } + [Test] public async Task Troubleshooting() { @@ -131,7 +153,7 @@ public async Task Troubleshooting() { Console.WriteLine(ex.Message); } - #endregion + #endregion Snippet:CommunicationIdentityClient_Troubleshooting catch (Exception ex) { Assert.Fail($"Unexpected error: {ex}"); From ea23010d7422cf9bf26998fe7e389a648193111c Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 9 Feb 2021 10:03:53 -0800 Subject: [PATCH 4/7] address comments --- sdk/communication/Azure.Communication.Chat/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md index 6685cac3bf4af..d3265e0032c06 100644 --- a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md @@ -4,8 +4,8 @@ ### Breaking Changes -- Replaced `CommunicationUser` with `CommunicationUserIdentifier`. -- Replaced `CommunicationUserCredential` with `CommunicationTokenCredential`. +- Renamed `CommunicationUser` to `CommunicationUserIdentifier`. +- Renamed `CommunicationUserCredential` to `CommunicationTokenCredential`. - Removed `Priority` field from `ChatMessage`. ### Added From 76d8a68c0b143b1523cb206654a0bb6167ef18cd Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 9 Feb 2021 11:07:54 -0800 Subject: [PATCH 5/7] add missing recordings --- .../CreateIdentityWithAccessKey.json | 46 +++++++++++++++++++ .../CreateIdentityWithAccessKeyAsync.json | 46 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKey.json create mode 100644 sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKeyAsync.json diff --git a/sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKey.json b/sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKey.json new file mode 100644 index 0000000000000..e9b9d59be8090 --- /dev/null +++ b/sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKey.json @@ -0,0 +1,46 @@ +{ + "Entries": [ + { + "RequestUri": "https://sanitized.communication.azure.com/identities?api-version=2021-03-07", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "2", + "Content-Type": "application/json", + "Date": "Tue, 09 Feb 2021 19:00:18 GMT", + "traceparent": "00-2739853fa682a64c86302ad2efcd8fc8-8f2ca594ec986949-00", + "User-Agent": [ + "azsdk-net-Communication.Identity/1.0.0-alpha.20210209.1", + "(.NET 5.0.2; Microsoft Windows 10.0.19042)" + ], + "x-ms-client-request-id": "b422eb1b4a717086d6d88b88fdbdf281", + "x-ms-content-sha256": "Sanitized", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": {}, + "StatusCode": 201, + "ResponseHeaders": { + "api-supported-versions": "2020-07-20-preview2, 2021-03-07", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 09 Feb 2021 19:00:20 GMT", + "MS-CV": "rm9vx5vriEuE1IxS1M\u002BgMw.0", + "Strict-Transport-Security": "max-age=2592000", + "Transfer-Encoding": "chunked", + "X-Azure-Ref": "0xNsiYAAAAAAqG3Oxmm/qS4ut8lDJEZc4WVZSMzBFREdFMDQyMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "x-ms-client-request-id": "b422eb1b4a717086d6d88b88fdbdf281", + "X-Processing-Time": "16ms" + }, + "ResponseBody": { + "identity": { + "id": "Sanitized" + } + } + } + ], + "Variables": { + "COMMUNICATION_ACCESS_KEY": "Kg==", + "COMMUNICATION_ENDPOINT": "https://sanitized.communication.azure.com/", + "RandomSeed": "1331219107" + } +} \ No newline at end of file diff --git a/sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKeyAsync.json b/sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKeyAsync.json new file mode 100644 index 0000000000000..ef963431a2b27 --- /dev/null +++ b/sdk/communication/Azure.Communication.Identity/tests/SessionRecords/Sample1_CommunicationIdentityClient/CreateIdentityWithAccessKeyAsync.json @@ -0,0 +1,46 @@ +{ + "Entries": [ + { + "RequestUri": "https://sanitized.communication.azure.com/identities?api-version=2021-03-07", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "2", + "Content-Type": "application/json", + "Date": "Tue, 09 Feb 2021 19:00:28 GMT", + "traceparent": "00-432592baa38f9f478fc4a7ff65820db4-642995910d5ad240-00", + "User-Agent": [ + "azsdk-net-Communication.Identity/1.0.0-alpha.20210209.1", + "(.NET 5.0.2; Microsoft Windows 10.0.19042)" + ], + "x-ms-client-request-id": "0037185a72fdbbffcd7a5fb531f1f483", + "x-ms-content-sha256": "Sanitized", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": {}, + "StatusCode": 201, + "ResponseHeaders": { + "api-supported-versions": "2020-07-20-preview2, 2021-03-07", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 09 Feb 2021 19:00:28 GMT", + "MS-CV": "wonWSTdSpEy1gnUlYGEsoA.0", + "Strict-Transport-Security": "max-age=2592000", + "Transfer-Encoding": "chunked", + "X-Azure-Ref": "0zNsiYAAAAAAKX7\u002BaTzYwS6A76kBLBZBeWVZSMzBFREdFMDQyMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "x-ms-client-request-id": "0037185a72fdbbffcd7a5fb531f1f483", + "X-Processing-Time": "17ms" + }, + "ResponseBody": { + "identity": { + "id": "Sanitized" + } + } + } + ], + "Variables": { + "COMMUNICATION_ACCESS_KEY": "Kg==", + "COMMUNICATION_ENDPOINT": "https://sanitized.communication.azure.com/", + "RandomSeed": "1340713197" + } +} \ No newline at end of file From 220a5aebb7b587a171fe1f1d9385cb031d6612d1 Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 9 Feb 2021 11:37:23 -0800 Subject: [PATCH 6/7] fix chat changelog entry --- sdk/communication/Azure.Communication.Chat/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md index d3265e0032c06..d24926a737ddd 100644 --- a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md @@ -4,7 +4,7 @@ ### Breaking Changes -- Renamed `CommunicationUser` to `CommunicationUserIdentifier`. +- Using common's `CommunicationUserIdentifier` and `CommmunicationIdentifier` in place of `CommunicationUser`. - Renamed `CommunicationUserCredential` to `CommunicationTokenCredential`. - Removed `Priority` field from `ChatMessage`. From 26d52bee979740b2ceac13c906fc7935174343a9 Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 9 Feb 2021 11:46:26 -0800 Subject: [PATCH 7/7] improved chat changelog --- sdk/communication/Azure.Communication.Chat/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md index d24926a737ddd..85c536138456c 100644 --- a/sdk/communication/Azure.Communication.Chat/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.Chat/CHANGELOG.md @@ -4,8 +4,7 @@ ### Breaking Changes -- Using common's `CommunicationUserIdentifier` and `CommmunicationIdentifier` in place of `CommunicationUser`. -- Renamed `CommunicationUserCredential` to `CommunicationTokenCredential`. +- Updated to Azure.Communication.Common version 1.0.0-beta.4. Now uses `CommunicationUserIdentifier` and `CommunicationIdentifier` in place of `CommunicationUser`, and `CommunicationTokenCredential` instead of `CommunicationUserCredential`. - Removed `Priority` field from `ChatMessage`. ### Added