| | | 1 | | using Microsoft.Azure.CognitiveServices.Language.TextAnalytics; |
| | | 2 | | |
| | | 3 | | namespace ApplicationCore.Analytics |
| | | 4 | | { |
| | | 5 | | public class TextAnalyticsClientFactory : ITextAnalyticsClientFactory |
| | | 6 | | { |
| | | 7 | | private readonly ICredentialsFactory _credentialsFactory; |
| | | 8 | | |
| | 3 | 9 | | public TextAnalyticsClientFactory(ICredentialsFactory credentialsFactory) |
| | 3 | 10 | | { |
| | 3 | 11 | | _credentialsFactory = credentialsFactory; |
| | 3 | 12 | | } |
| | | 13 | | |
| | | 14 | | public ITextAnalyticsClient CreateClient(string subscriptionKey, string region) |
| | 1 | 15 | | { |
| | 1 | 16 | | return new TextAnalyticsClient( |
| | 1 | 17 | | _credentialsFactory.CreateApiKeyServiceCredentials(subscriptionKey)) |
| | 1 | 18 | | { |
| | 1 | 19 | | Endpoint = $"https://{region}.api.cognitive.microsoft.com" |
| | 1 | 20 | | }; |
| | 1 | 21 | | } |
| | | 22 | | } |
| | | 23 | | } |