| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using Azure; |
| | 6 | | using Azure.AI.TextAnalytics; |
| | 7 | | using Azure.Core.Extensions; |
| | 8 | |
|
| | 9 | | namespace Microsoft.Extensions.Azure |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Extension methods to add <see cref="TextAnalyticsClient"/> client to clients builder. |
| | 13 | | /// </summary> |
| | 14 | | public static class TextAnalyticsClientBuilderExtensions |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Registers a <see cref="TextAnalyticsClient"/> instance with the provided <paramref name="endpoint"/>. |
| | 18 | | /// </summary> |
| | 19 | | public static IAzureClientBuilder<TextAnalyticsClient, TextAnalyticsClientOptions> AddTextAnalyticsClient<TBuild |
| | 20 | | where TBuilder : IAzureClientFactoryBuilderWithCredential |
| | 21 | | { |
| 0 | 22 | | return builder.RegisterClientFactory<TextAnalyticsClient, TextAnalyticsClientOptions>((options, credential) |
| | 23 | | } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Registers a <see cref="TextAnalyticsClient"/> instance with the provided <paramref name="endpoint"/> and <pa |
| | 27 | | /// </summary> |
| | 28 | | public static IAzureClientBuilder<TextAnalyticsClient, TextAnalyticsClientOptions> AddTextAnalyticsClient<TBuild |
| | 29 | | where TBuilder : IAzureClientFactoryBuilder |
| | 30 | | { |
| 0 | 31 | | return builder.RegisterClientFactory<TextAnalyticsClient, TextAnalyticsClientOptions>(options => new TextAna |
| | 32 | | } |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// Registers a <see cref="TextAnalyticsClient"/> instance with connection options loaded from the provided <par |
| | 36 | | /// </summary> |
| | 37 | | public static IAzureClientBuilder<TextAnalyticsClient, TextAnalyticsClientOptions> AddTextAnalyticsClient<TBuild |
| | 38 | | where TBuilder : IAzureClientFactoryBuilderWithConfiguration<TConfiguration> |
| | 39 | | { |
| 0 | 40 | | return builder.RegisterClientFactory<TextAnalyticsClient, TextAnalyticsClientOptions>(configuration); |
| | 41 | | } |
| | 42 | | } |
| | 43 | | } |