From f6407d9317008112b17bc5e2c57f3dd181a5e1c3 Mon Sep 17 00:00:00 2001 From: glorialimicrosoft <67171398+glorialimicrosoft@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:53:36 -0800 Subject: [PATCH] Change channel id of GetTemplates operation to GUID (#41909) * change channel id of getTemplate operation to uuid * rerun Export-API.ps1 * update version --- .../Azure.Communication.Messages/CHANGELOG.md | 2 +- ...e.Communication.Messages.netstandard2.0.cs | 8 ++-- .../src/Azure.Communication.Messages.csproj | 2 +- .../Generated/Docs/MessageTemplateClient.xml | 24 +++++----- .../src/Generated/MessageTemplateClient.cs | 48 +++++++------------ .../src/Generated/tspCodeModel.json | 6 +-- .../Samples/Samples_MessageTemplateClient.cs | 16 +++---- .../GetTemplatesShouldSucceed.json | 18 +++---- .../GetTemplatesShouldSucceedAsync.json | 16 +++---- ...esWithAzureKeyCredentialShouldSucceed.json | 18 +++---- ...hAzureKeyCredentialShouldSucceedAsync.json | 16 +++---- .../MessageTemplateClientLiveTests.cs | 4 +- .../MessageTemplateClientTests.cs | 40 ++-------------- .../tsp-location.yaml | 2 +- 14 files changed, 87 insertions(+), 133 deletions(-) diff --git a/sdk/communication/Azure.Communication.Messages/CHANGELOG.md b/sdk/communication/Azure.Communication.Messages/CHANGELOG.md index 2324adc0f8ca5..2a250fac1093b 100644 --- a/sdk/communication/Azure.Communication.Messages/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.Messages/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0 (Unreleased) ### Features Added diff --git a/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs b/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs index 0a4b3ba7e4a8f..268dec561ea05 100644 --- a/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs @@ -80,10 +80,10 @@ public MessageTemplateClient(System.Uri endpoint, Azure.AzureKeyCredential crede public MessageTemplateClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public MessageTemplateClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.Messages.CommunicationMessagesClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Pageable GetTemplates(string channelId, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetTemplates(string channelId, int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetTemplatesAsync(string channelId, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetTemplatesAsync(string channelId, int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetTemplates(System.Guid channelId, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetTemplates(System.Guid channelId, int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTemplatesAsync(System.Guid channelId, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetTemplatesAsync(System.Guid channelId, int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MessageTemplateDocument : Azure.Communication.Messages.MessageTemplateValue, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { diff --git a/sdk/communication/Azure.Communication.Messages/src/Azure.Communication.Messages.csproj b/sdk/communication/Azure.Communication.Messages/src/Azure.Communication.Messages.csproj index 06c4f72b4b5af..dd4a64e4b0c54 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Azure.Communication.Messages.csproj +++ b/sdk/communication/Azure.Communication.Messages/src/Azure.Communication.Messages.csproj @@ -5,7 +5,7 @@ This client library enables working with the Microsoft Azure Communication Messages service. Azure Communication Messages Service - 1.0.0-beta.2 + 1.0.0 Microsoft Azure Communication Messages Service;Microsoft;Azure;Azure Communication Service;Azure Communication Messages Service;Messages;Communication $(RequiredTargetFrameworks) true diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml index f66b564adcec6..36b2ba72b7c15 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml @@ -1,13 +1,13 @@ - + This sample shows how to call GetTemplatesAsync. ")) +await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { } ]]> @@ -15,18 +15,18 @@ This sample shows how to call GetTemplatesAsync with all parameters. ", maxpagesize: 1234)) +await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234)) { } ]]> - + This sample shows how to call GetTemplates. ")) +foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { } ]]> @@ -34,18 +34,18 @@ This sample shows how to call GetTemplates with all parameters. ", maxpagesize: 1234)) +foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234)) { } ]]> - + This sample shows how to call GetTemplatesAsync and parse the result. ", null, null)) +await foreach (BinaryData item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -58,7 +58,7 @@ This sample shows how to call GetTemplatesAsync with all parameters and parse th ", 1234, null)) +await foreach (BinaryData item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -68,13 +68,13 @@ await foreach (BinaryData item in client.GetTemplatesAsync("", 1234, } ]]> - + This sample shows how to call GetTemplates and parse the result. ", null, null)) +foreach (BinaryData item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -87,7 +87,7 @@ This sample shows how to call GetTemplates with all parameters and parse the res ", 1234, null)) +foreach (BinaryData item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs index 728202a0473e3..e4d1aa3184d6b 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs @@ -66,34 +66,26 @@ public MessageTemplateClient(Uri endpoint, TokenCredential credential, Communica _apiVersion = options.Version; } - /// List all templates for given ACS channel. + /// List all templates for given Azure Communication Services channel. /// The registration ID of the channel. /// Number of objects to return per page. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual AsyncPageable GetTemplatesAsync(string channelId, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual AsyncPageable GetTemplatesAsync(Guid channelId, int? maxpagesize = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(channelId, nameof(channelId)); - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxpagesize, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => MessageTemplateItem.DeserializeMessageTemplateItem(e), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", context); } - /// List all templates for given ACS channel. + /// List all templates for given Azure Communication Services channel. /// The registration ID of the channel. /// Number of objects to return per page. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Pageable GetTemplates(string channelId, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + public virtual Pageable GetTemplates(Guid channelId, int? maxpagesize = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(channelId, nameof(channelId)); - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxpagesize, context); @@ -101,7 +93,7 @@ public virtual Pageable GetTemplates(string channelId, int? } /// - /// [Protocol Method] List all templates for given ACS channel + /// [Protocol Method] List all templates for given Azure Communication Services channel /// /// /// @@ -110,7 +102,7 @@ public virtual Pageable GetTemplates(string channelId, int? /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -118,22 +110,18 @@ public virtual Pageable GetTemplates(string channelId, int? /// The registration ID of the channel. /// Number of objects to return per page. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetTemplatesAsync(string channelId, int? maxpagesize, RequestContext context) + /// + public virtual AsyncPageable GetTemplatesAsync(Guid channelId, int? maxpagesize, RequestContext context) { - Argument.AssertNotNullOrEmpty(channelId, nameof(channelId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxpagesize, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", context); } /// - /// [Protocol Method] List all templates for given ACS channel + /// [Protocol Method] List all templates for given Azure Communication Services channel /// /// /// @@ -142,7 +130,7 @@ public virtual AsyncPageable GetTemplatesAsync(string channelId, int /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -150,21 +138,17 @@ public virtual AsyncPageable GetTemplatesAsync(string channelId, int /// The registration ID of the channel. /// Number of objects to return per page. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetTemplates(string channelId, int? maxpagesize, RequestContext context) + /// + public virtual Pageable GetTemplates(Guid channelId, int? maxpagesize, RequestContext context) { - Argument.AssertNotNullOrEmpty(channelId, nameof(channelId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxpagesize, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", context); } - internal HttpMessage CreateGetTemplatesRequest(string channelId, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetTemplatesRequest(Guid channelId, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -184,7 +168,7 @@ internal HttpMessage CreateGetTemplatesRequest(string channelId, int? maxpagesiz return message; } - internal HttpMessage CreateGetTemplatesNextPageRequest(string nextLink, string channelId, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetTemplatesNextPageRequest(string nextLink, Guid channelId, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/tspCodeModel.json b/sdk/communication/Azure.Communication.Messages/src/Generated/tspCodeModel.json index e04a117b94907..8dbbfc800b84a 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/tspCodeModel.json +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/tspCodeModel.json @@ -519,7 +519,7 @@ "Type": { "$id": "64", "Kind": "Primitive", - "Name": "String", + "Name": "Guid", "IsNullable": false }, "IsRequired": true, @@ -1736,7 +1736,7 @@ "$id": "199", "Name": "getTemplates", "ResourceName": "MessageTemplateItem", - "Description": "List all templates for given ACS channel", + "Description": "List all templates for given Azure Communication Services channel", "Parameters": [ { "$ref": "155" @@ -1773,7 +1773,7 @@ "Type": { "$id": "203", "Kind": "Primitive", - "Name": "String", + "Name": "Guid", "IsNullable": false }, "Location": "Path", diff --git a/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs index 46517d3ea853b..e2672969aa6de 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs +++ b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs @@ -23,7 +23,7 @@ public void Example_MessageTemplateItem_GetTemplates_ShortVersion() { MessageTemplateClient client = new MessageTemplateClient((string)null); - foreach (BinaryData item in client.GetTemplates("", null, null)) + foreach (BinaryData item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -39,7 +39,7 @@ public async Task Example_MessageTemplateItem_GetTemplates_ShortVersion_Async() { MessageTemplateClient client = new MessageTemplateClient((string)null); - await foreach (BinaryData item in client.GetTemplatesAsync("", null, null)) + await foreach (BinaryData item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -55,7 +55,7 @@ public void Example_MessageTemplateItem_GetTemplates_ShortVersion_Convenience() { MessageTemplateClient client = new MessageTemplateClient((string)null); - foreach (MessageTemplateItem item in client.GetTemplates("")) + foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { } } @@ -66,7 +66,7 @@ public async Task Example_MessageTemplateItem_GetTemplates_ShortVersion_Convenie { MessageTemplateClient client = new MessageTemplateClient((string)null); - await foreach (MessageTemplateItem item in client.GetTemplatesAsync("")) + await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) { } } @@ -77,7 +77,7 @@ public void Example_MessageTemplateItem_GetTemplates_AllParameters() { MessageTemplateClient client = new MessageTemplateClient((string)null); - foreach (BinaryData item in client.GetTemplates("", 1234, null)) + foreach (BinaryData item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -93,7 +93,7 @@ public async Task Example_MessageTemplateItem_GetTemplates_AllParameters_Async() { MessageTemplateClient client = new MessageTemplateClient((string)null); - await foreach (BinaryData item in client.GetTemplatesAsync("", 1234, null)) + await foreach (BinaryData item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -109,7 +109,7 @@ public void Example_MessageTemplateItem_GetTemplates_AllParameters_Convenience() { MessageTemplateClient client = new MessageTemplateClient((string)null); - foreach (MessageTemplateItem item in client.GetTemplates("", maxpagesize: 1234)) + foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234)) { } } @@ -120,7 +120,7 @@ public async Task Example_MessageTemplateItem_GetTemplates_AllParameters_Conveni { MessageTemplateClient client = new MessageTemplateClient((string)null); - await foreach (MessageTemplateItem item in client.GetTemplatesAsync("", maxpagesize: 1234)) + await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234)) { } } diff --git a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceed.json b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceed.json index 33817f672ce4e..2a8d39b147f46 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceed.json +++ b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceed.json @@ -6,11 +6,11 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-6c287f0f10167c6b3a59a10c4adc40df-399ca24ecdec1ff3-00", - "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240209.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", - "x-ms-client-request-id": "e0a917c6119fc30872f5c0ac9346b92a", + "traceparent": "00-50a9746431834f9ebf1ebc616788c427-3c8e23788d60258f-00", + "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240212.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", + "x-ms-client-request-id": "48197a1c07289e82c8739eb798941b85", "x-ms-content-sha256": "Sanitized", - "x-ms-date": "Fri, 09 Feb 2024 22:11:49 GMT", + "x-ms-date": "Mon, 12 Feb 2024 18:03:30 GMT", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -21,13 +21,13 @@ "Connection": "keep-alive", "Content-Length": "8368", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Feb 2024 22:11:54 GMT", - "MS-CV": "hpXlaDfpO0O41XtkmL9D6w.0", + "Date": "Mon, 12 Feb 2024 18:03:32 GMT", + "MS-CV": "JWF0mQM6LkqMyM7lUA1iSg.0", "Request-Context": "appId=", "Strict-Transport-Security": "max-age=2592000", - "x-azure-ref": "20240209T221153Z-pfcn9br3b11kd2xessn2xp84ns000000030000000001ktsf", + "x-azure-ref": "20240212T180332Z-1w6ceb9a55775bf569t7a9vm1n00000004900000000066am", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "416ms" + "X-Processing-Time": "524ms" }, "ResponseBody": { "value": [ @@ -577,7 +577,7 @@ ], "Variables": { "COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING": "endpoint=https://sanitized.communication.azure.com/;accesskey=Kg==", - "RandomSeed": "1101540093", + "RandomSeed": "449509073", "SENDER_CHANNEL_REGISTRATION_ID": "77ffd898-ec44-42cd-b560-57a8903d05c7" } } diff --git a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceedAsync.json b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceedAsync.json index 5b8ddb82b9ffe..9aa9eddfcc28c 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceedAsync.json +++ b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesShouldSucceedAsync.json @@ -6,10 +6,10 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240209.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", - "x-ms-client-request-id": "6f11d5ea0f717c27ee3735e0435953e5", + "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240212.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", + "x-ms-client-request-id": "1490d3ed21e83400a83a583445721ca3", "x-ms-content-sha256": "Sanitized", - "x-ms-date": "Fri, 09 Feb 2024 22:11:52 GMT", + "x-ms-date": "Mon, 12 Feb 2024 18:03:34 GMT", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -20,13 +20,13 @@ "Connection": "keep-alive", "Content-Length": "8368", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Feb 2024 22:11:55 GMT", - "MS-CV": "gW\u002BsP0LWWECdweH3hgdKPA.0", + "Date": "Mon, 12 Feb 2024 18:03:35 GMT", + "MS-CV": "FoZlDJ6wukaOIHp01KF3kQ.0", "Request-Context": "appId=", "Strict-Transport-Security": "max-age=2592000", - "x-azure-ref": "20240209T221155Z-pfcn9br3b11kd2xessn2xp84ns000000030000000001ku4m", + "x-azure-ref": "20240212T180335Z-1w6ceb9a55775bf569t7a9vm1n00000004900000000066d1", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "167ms" + "X-Processing-Time": "290ms" }, "ResponseBody": { "value": [ @@ -576,7 +576,7 @@ ], "Variables": { "COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING": "endpoint=https://sanitized.communication.azure.com/;accesskey=Kg==", - "RandomSeed": "2097829266", + "RandomSeed": "100198068", "SENDER_CHANNEL_REGISTRATION_ID": "77ffd898-ec44-42cd-b560-57a8903d05c7" } } diff --git a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceed.json b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceed.json index 9059a49e4ce8a..e128d1b2d5ac3 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceed.json +++ b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceed.json @@ -6,11 +6,11 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-822b4c907439579a91ccd08649eafb16-f30cfdf996614155-00", - "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240209.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", - "x-ms-client-request-id": "4ad34053153f7e98ade9c83bcb2b966e", + "traceparent": "00-4f08f2c406e40f97f771044ce8b2eff4-dcb8272e52b93b6e-00", + "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240212.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", + "x-ms-client-request-id": "747624272a3a01694c3a378b9a5b157b", "x-ms-content-sha256": "Sanitized", - "x-ms-date": "Fri, 09 Feb 2024 22:11:52 GMT", + "x-ms-date": "Mon, 12 Feb 2024 18:03:33 GMT", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -21,13 +21,13 @@ "Connection": "keep-alive", "Content-Length": "8368", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Feb 2024 22:11:55 GMT", - "MS-CV": "8KG\u002BNi4UG0e0j89O1LAp0Q.0", + "Date": "Mon, 12 Feb 2024 18:03:34 GMT", + "MS-CV": "GCdbmuC5PUCwiqQXFYISSQ.0", "Request-Context": "appId=", "Strict-Transport-Security": "max-age=2592000", - "x-azure-ref": "20240209T221154Z-pfcn9br3b11kd2xessn2xp84ns000000030000000001ku1s", + "x-azure-ref": "20240212T180333Z-1w6ceb9a55775bf569t7a9vm1n00000004900000000066bp", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "183ms" + "X-Processing-Time": "294ms" }, "ResponseBody": { "value": [ @@ -577,7 +577,7 @@ ], "Variables": { "COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING": "endpoint=https://sanitized.communication.azure.com/;accesskey=Kg==", - "RandomSeed": "524703772", + "RandomSeed": "1354774971", "SENDER_CHANNEL_REGISTRATION_ID": "77ffd898-ec44-42cd-b560-57a8903d05c7" } } diff --git a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceedAsync.json b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceedAsync.json index 0b8271dbea714..853a340ed88d7 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceedAsync.json +++ b/sdk/communication/Azure.Communication.Messages/tests/SessionRecords/MessageTemplateClientLiveTests/GetTemplatesWithAzureKeyCredentialShouldSucceedAsync.json @@ -6,10 +6,10 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240209.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", - "x-ms-client-request-id": "2c56b863af486a49d1ed6c33a1e79903", + "User-Agent": "azsdk-net-Communication.Messages/1.0.0-alpha.20240212.1 (.NET 7.0.15; Microsoft Windows 10.0.22631)", + "x-ms-client-request-id": "647fbd8320c91b91cc276ec5d0e1a58f", "x-ms-content-sha256": "Sanitized", - "x-ms-date": "Fri, 09 Feb 2024 22:11:53 GMT", + "x-ms-date": "Mon, 12 Feb 2024 18:03:35 GMT", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -20,13 +20,13 @@ "Connection": "keep-alive", "Content-Length": "8368", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Feb 2024 22:11:56 GMT", - "MS-CV": "9TOipqO79EKgnq2vOdomUQ.0", + "Date": "Mon, 12 Feb 2024 18:03:35 GMT", + "MS-CV": "F8HrEw214UKKyjGUWo40mw.0", "Request-Context": "appId=", "Strict-Transport-Security": "max-age=2592000", - "x-azure-ref": "20240209T221155Z-pfcn9br3b11kd2xessn2xp84ns000000030000000001ku8a", + "x-azure-ref": "20240212T180335Z-1w6ceb9a55775bf569t7a9vm1n00000004900000000066dp", "X-Cache": "CONFIG_NOCACHE", - "X-Processing-Time": "514ms" + "X-Processing-Time": "269ms" }, "ResponseBody": { "value": [ @@ -576,7 +576,7 @@ ], "Variables": { "COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING": "endpoint=https://sanitized.communication.azure.com/;accesskey=Kg==", - "RandomSeed": "305775920", + "RandomSeed": "866736365", "SENDER_CHANNEL_REGISTRATION_ID": "77ffd898-ec44-42cd-b560-57a8903d05c7" } } diff --git a/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientLiveTests.cs b/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientLiveTests.cs index edbd4de98a9a7..7e1c1488e17b0 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientLiveTests.cs +++ b/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientLiveTests.cs @@ -22,7 +22,7 @@ public Task GetTemplatesShouldSucceed() { // Arrange MessageTemplateClient messageTemplateClient = CreateInstrumentedMessageTemplateClient(); - string channelRegistrationId = TestEnvironment.SenderChannelRegistrationId; + var channelRegistrationId = new Guid(TestEnvironment.SenderChannelRegistrationId); // Act AsyncPageable templates = messageTemplateClient.GetTemplatesAsync(channelRegistrationId); @@ -46,7 +46,7 @@ public Task GetTemplatesWithAzureKeyCredentialShouldSucceed() { // Arrange MessageTemplateClient messageTemplateClient = CreateInstrumentedMessageTemplateClientWithAzureKeyCredential(); - string channelRegistrationId = TestEnvironment.SenderChannelRegistrationId; + var channelRegistrationId = new Guid(TestEnvironment.SenderChannelRegistrationId); // Act AsyncPageable templates = messageTemplateClient.GetTemplatesAsync(channelRegistrationId); diff --git a/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientTests.cs b/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientTests.cs index d33939f3617bc..f84ddbcf538f9 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientTests.cs +++ b/sdk/communication/Azure.Communication.Messages/tests/TemplateClient/MessageTemplateClientTests.cs @@ -44,11 +44,13 @@ public Task GetTemplates_InvalidChannelId_ShouldThrowBadRequestException() { //arrange MessageTemplateClient messageTemplateClient = CreateMockMessageTemplateClient(); + var emptyChannelId = Guid.Empty; + // Act & Assert try { //act - messageTemplateClient.GetTemplatesAsync("invalidChannelRegistrationId"); + messageTemplateClient.GetTemplatesAsync(emptyChannelId); } catch (RequestFailedException requestFailedException) { @@ -59,24 +61,12 @@ public Task GetTemplates_InvalidChannelId_ShouldThrowBadRequestException() return Task.CompletedTask; } - [Test] - public void GetTemplates_NullOrEmptyChannelId_ShouldThrowArgumentNullException() - { - // Arrange - MessageTemplateClient messageTemplateClient = CreateMockMessageTemplateClient(); - - // Act & Assert - Assert.Throws(() => messageTemplateClient.GetTemplatesAsync(null)); - Assert.Throws(() => messageTemplateClient.GetTemplatesAsync(string.Empty)); - Assert.Throws(() => messageTemplateClient.GetTemplatesAsync("")); - } - [Test] public async Task GetTemplates_ValidParams_ShouldSucceed() { //arrange MessageTemplateClient messageTemplateClient = CreateMockMessageTemplateClient(200, GetTemplatesApiResponsePayload); - var channelId = Guid.NewGuid().ToString(); + var channelId = Guid.NewGuid(); //act AsyncPageable templates = messageTemplateClient.GetTemplatesAsync(channelId); @@ -98,27 +88,7 @@ public void GetTemplates_NullChannelId_Throws() MessageTemplateClient messageTemplateClient = CreateMockMessageTemplateClient(); //act & assert - Assert.Throws(() => messageTemplateClient.GetTemplatesAsync(null)); - } - - [Test] - public Task GetTemplates_InvalidChannelRegistrationId_ThrowsBadRequestException() - { - //arrange - MessageTemplateClient messageTemplateClient = CreateMockMessageTemplateClient(400); - - try - { - //act - messageTemplateClient.GetTemplatesAsync("invalidChannelRegistrationId"); - } - catch (RequestFailedException requestFailedException) - { - //assert - Assert.AreEqual(400, requestFailedException.Status); - } - - return Task.CompletedTask; + Assert.Throws(() => messageTemplateClient.GetTemplatesAsync(new Guid(string.Empty))); } private static MessageTemplateClient CreateMockMessageTemplateClient(int responseCode = 200, string responseContent = null) diff --git a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml index 0c4a60d67186e..016cf391ff824 100644 --- a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml +++ b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: 6cecaf43ab9c1104e683aea3b185b88f81be2750 +commit: 2c535d9e0a407d8a03ee96e6815d84849377b9f5 directory: specification/communication/Communication.Messages additionalDirectories: [] repo: Azure/azure-rest-api-specs \ No newline at end of file