Skip to content

Commit 67398a3

Browse files
Migrate to new generator (Azure#55464)
* Migrate to new generator * newline * api * inv * inv * regen * api * regen * add missing convenience methods * add missing convenience methods
1 parent c2fb9ec commit 67398a3

File tree

316 files changed

+11982
-14824
lines changed

Some content is hidden

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

316 files changed

+11982
-14824
lines changed

doc/GeneratorMigration/Library_Inventory.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
- Old TypeSpec: 1
2121
- Data Plane (DPG): 144
2222
- Autorest/Swagger: 58
23-
- New Emitter (TypeSpec): 30
24-
- Old TypeSpec: 8
23+
- New Emitter (TypeSpec): 31
24+
- Old TypeSpec: 7
2525
- Provisioning: 31
2626
- Custom reflection-based generator: 31
2727
- No generator: 48
@@ -31,7 +31,7 @@
3131

3232
Libraries that provide client APIs for Azure services and have been migrated to the new TypeSpec emitter.
3333

34-
**Migration Status**: 30 / 38 (78.9%)
34+
**Migration Status**: 31 / 38 (81.6%)
3535

3636
| Service | Library | New Emitter |
3737
| ------- | ------- | ----------- |
@@ -41,7 +41,7 @@ Libraries that provide client APIs for Azure services and have been migrated to
4141
| anomalydetector | Azure.AI.AnomalyDetector | |
4242
| appconfiguration | Azure.Data.AppConfiguration ||
4343
| batch | Azure.Compute.Batch ||
44-
| cognitivelanguage | Azure.AI.Language.Conversations | |
44+
| cognitivelanguage | Azure.AI.Language.Conversations | |
4545
| cognitivelanguage | Azure.AI.Language.Conversations.Authoring | |
4646
| cognitivelanguage | Azure.AI.Language.QuestionAnswering.Authoring ||
4747
| cognitivelanguage | Azure.AI.Language.QuestionAnswering.Inference ||

sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net10.0.cs

Lines changed: 455 additions & 61 deletions
Large diffs are not rendered by default.

sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs

Lines changed: 455 additions & 61 deletions
Large diffs are not rendered by default.

sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs

Lines changed: 455 additions & 61 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"apiVersion": "2025-11-15-preview"
3+
}

sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Azure.AI.Language.Conversations.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
1010
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
1111
<NoWarn>$(NoWarn);AZC0034;AZC0035</NoWarn>
12-
<IncludeAutorestDependency>true</IncludeAutorestDependency>
1312
</PropertyGroup>
1413

1514
<ItemGroup>

sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationAnalysisClient.cs

Lines changed: 22 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

44
using System;
@@ -7,39 +7,21 @@
77
using Azure.AI.Language.Conversations.Models;
88
using Azure.Core;
99
using Azure.Core.Pipeline;
10+
using Microsoft.TypeSpec.Generator.Customizations;
1011

1112
namespace Azure.AI.Language.Conversations
1213
{
14+
/// <summary>
15+
/// The <see cref="ConversationAnalysisClient"/> allows for the analysis of conversations.
16+
/// </summary>
17+
[CodeGenType("ConversationAnalysis")]
1318
public partial class ConversationAnalysisClient
1419
{
1520
/// <summary>
1621
/// Gets the service endpoint for this client.
1722
/// </summary>
1823
public virtual Uri Endpoint => _endpoint;
1924

20-
private readonly TokenCredential _tokenCredential;
21-
22-
/// <summary> Initializes a new instance of ConversationAnalysisClient. </summary>
23-
/// <param name="endpoint"> Supported Cognitive Services endpoint (e.g., https://&lt;resource-name&gt;.cognitiveservices.azure.com). </param>
24-
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
25-
/// <param name="options"> The options for configuring the client. </param>
26-
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
27-
public ConversationAnalysisClient(Uri endpoint, TokenCredential credential, ConversationsClientOptions options)
28-
{
29-
Argument.AssertNotNull(endpoint, nameof(endpoint));
30-
Argument.AssertNotNull(credential, nameof(credential));
31-
options ??= new ConversationsClientOptions();
32-
33-
var authorizationScope = $"{(string.IsNullOrEmpty(options.Audience?.ToString()) ? ConversationsAudience.AzurePublicCloud : options.Audience)}/.default";
34-
35-
_tokenCredential = credential;
36-
37-
ClientDiagnostics = new ClientDiagnostics(options, true);
38-
_pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(credential, authorizationScope) }, Array.Empty<HttpPipelinePolicy>(), new ResponseClassifier());
39-
_endpoint = endpoint;
40-
_apiVersion = options.Version;
41-
}
42-
4325
/// <summary>
4426
/// Convenience method to submit an analysis long running operation for conversations and return the response once processed.
4527
/// <param name="analyzeConversationOperationInput"> The input for the analyze conversations operation. </param>
@@ -52,12 +34,12 @@ public virtual Response<AnalyzeConversationOperationState> AnalyzeConversations(
5234
{
5335
Argument.AssertNotNull(analyzeConversationOperationInput, nameof(analyzeConversationOperationInput));
5436

55-
using RequestContent content = analyzeConversationOperationInput.ToRequestContent();
56-
RequestContext context = FromCancellationToken(cancellationToken);
37+
using RequestContent content = analyzeConversationOperationInput;
38+
RequestContext context = cancellationToken.ToRequestContext();
5739

5840
Operation<BinaryData> operation = AnalyzeConversations(WaitUntil.Completed, content, context);
5941
Response response = operation.GetRawResponse();
60-
return Response.FromValue(AnalyzeConversationOperationState.FromResponse(response), response);
42+
return Response.FromValue((AnalyzeConversationOperationState)response, response);
6143
}
6244

6345
/// <summary>
@@ -72,44 +54,34 @@ public virtual async Task<Response<AnalyzeConversationOperationState>> AnalyzeCo
7254
{
7355
Argument.AssertNotNull(analyzeConversationOperationInput, nameof(analyzeConversationOperationInput));
7456

75-
using RequestContent content = analyzeConversationOperationInput.ToRequestContent();
76-
RequestContext context = FromCancellationToken(cancellationToken);
57+
using RequestContent content = analyzeConversationOperationInput;
58+
RequestContext context = cancellationToken.ToRequestContext();
7759

7860
Operation<BinaryData> operation = await AnalyzeConversationsAsync(WaitUntil.Completed, content, context).ConfigureAwait(false);
7961
Response response = operation.GetRawResponse();
80-
return Response.FromValue(AnalyzeConversationOperationState.FromResponse(response), response);
62+
return Response.FromValue((AnalyzeConversationOperationState)response, response);
8163
}
8264

8365
/// <summary>
8466
/// [Protocol Method] Submits an analysis long running operation for conversations and return the response once processed.
85-
/// <list type="bullet">
86-
/// <item>
87-
/// <description>
88-
/// This <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/ProtocolMethods.md">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios.
89-
/// </description>
90-
/// </item>
91-
/// <item>
92-
/// <description>
93-
/// Please try the simpler <see cref="AnalyzeConversations(AnalyzeConversationOperationInput,CancellationToken)"/> convenience overload with strongly typed models first.
94-
/// </description>
95-
/// </item>
96-
/// </list>
9767
/// </summary>
98-
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
68+
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. </param>
9969
/// <param name="content"> The content to send as the body of the request. </param>
10070
/// <param name="context"> The request context, which can override default behaviors of the client pipeline on a per-call basis. </param>
10171
/// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
10272
/// <exception cref="RequestFailedException"> Service returned a non-success status code. </exception>
103-
/// <returns> The <see cref="Operation"/> representing an asynchronous operation on the service. </returns>
73+
/// <returns> The <see cref="Operation{T}"/> representing an asynchronous operation on the service. </returns>
10474
public virtual Operation<BinaryData> AnalyzeConversations(WaitUntil waitUntil, RequestContent content, RequestContext context = default)
10575
{
10676
using DiagnosticScope scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversations");
10777
scope.Start();
10878

10979
try
11080
{
81+
Argument.AssertNotNull(content, nameof(content));
82+
11183
using HttpMessage message = CreateAnalyzeConversationSubmitOperationRequest(content, context);
112-
return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.OperationLocation, context, WaitUntil.Completed);
84+
return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.OperationLocation, context, waitUntil);
11385
}
11486
catch (Exception e)
11587
{
@@ -120,34 +92,24 @@ public virtual Operation<BinaryData> AnalyzeConversations(WaitUntil waitUntil, R
12092

12193
/// <summary>
12294
/// [Protocol Method] Submits an analysis long running operation for conversations and return the response once processed.
123-
/// <list type="bullet">
124-
/// <item>
125-
/// <description>
126-
/// This <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/ProtocolMethods.md">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios.
127-
/// </description>
128-
/// </item>
129-
/// <item>
130-
/// <description>
131-
/// Please try the simpler <see cref="AnalyzeConversationsAsync(AnalyzeConversationOperationInput,CancellationToken)"/> convenience overload with strongly typed models first.
132-
/// </description>
133-
/// </item>
134-
/// </list>
13595
/// </summary>
136-
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
96+
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. </param>
13797
/// <param name="content"> The content to send as the body of the request. </param>
13898
/// <param name="context"> The request context, which can override default behaviors of the client pipeline on a per-call basis. </param>
13999
/// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
140100
/// <exception cref="RequestFailedException"> Service returned a non-success status code. </exception>
141-
/// <returns> The <see cref="Operation"/> representing an asynchronous operation on the service. </returns>
101+
/// <returns> The <see cref="Operation{T}"/> representing an asynchronous operation on the service. </returns>
142102
public virtual async Task<Operation<BinaryData>> AnalyzeConversationsAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = default)
143103
{
144104
using DiagnosticScope scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversations");
145105
scope.Start();
146106

147107
try
148108
{
109+
Argument.AssertNotNull(content, nameof(content));
110+
149111
using HttpMessage message = CreateAnalyzeConversationSubmitOperationRequest(content, context);
150-
return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.OperationLocation, context, WaitUntil.Completed).ConfigureAwait(false);
112+
return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false);
151113
}
152114
catch (Exception e)
153115
{

sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationAnalysisClientExtensions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

44
using System;
@@ -7,10 +7,14 @@
77
using Azure.AI.Language.Conversations.Authoring;
88
using Azure.Core;
99
using Azure.Core.Extensions;
10+
using Microsoft.TypeSpec.Generator.Customizations;
1011

1112
namespace Microsoft.Extensions.Azure
1213
{
13-
[CodeGenModel("AILanguageConversationsClientBuilderExtensions")]
14+
/// <summary>
15+
/// Extension methods to add <see cref="ConversationAnalysisClient"/> to the Azure client builder.
16+
/// </summary>
17+
[CodeGenType("LanguageConversationsClientBuilderExtensions")]
1418
public static partial class ConversationAnalysisClientExtensions
1519
{
1620
/// <summary> Registers a <see cref="ConversationAuthoringClient"/> instance. </summary>

sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsClientOptions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

44
using Azure.Core;
5+
using Microsoft.TypeSpec.Generator.Customizations;
56

67
namespace Azure.AI.Language.Conversations
78
{
8-
[CodeGenModel("ConversationAnalysisClientOptions")]
9+
/// <summary>
10+
/// Client options for <see cref="ConversationAnalysisClient"/>.
11+
/// </summary>
12+
[CodeGenType("ConversationAnalysisClientOptions")]
913
public partial class ConversationsClientOptions : ClientOptions
1014
{
1115
/// <summary>

sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsModelFactory.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

44
using Azure.Core;
5+
using Microsoft.TypeSpec.Generator.Customizations;
56

67
namespace Azure.AI.Language.Conversations
78
{
8-
[CodeGenModel("AILanguageConversationsModelFactory")]
9+
/// <summary>
10+
/// Model factory for read-only models in the Conversations namespace.
11+
/// </summary>
12+
[CodeGenType("LanguageConversationsModelFactory")]
913
public static partial class ConversationsModelFactory
1014
{
1115
}

0 commit comments

Comments
 (0)