diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/ApiKeyServiceClientCredentials.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/ApiKeyServiceClientCredentials.cs new file mode 100644 index 000000000000..2a44f8ff70ad --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/ApiKeyServiceClientCredentials.cs @@ -0,0 +1,43 @@ +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics +{ + using System; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Rest; + + /// + /// Allows authentication to the API using a basic apiKey mechanism + /// + public class ApiKeyServiceClientCredentials : ServiceClientCredentials + { + private readonly string subscriptionKey; + + /// + /// Creates a new instance of the ApiKeyServiceClientCredentails class + /// + /// The subscription key to authenticate and authorize as + public ApiKeyServiceClientCredentials(string subscriptionKey) + { + if (string.IsNullOrWhiteSpace(subscriptionKey)) + throw new ArgumentNullException("subscriptionKey"); + + this.subscriptionKey = subscriptionKey; + } + + /// + /// Add the Basic Authentication Header to each outgoing request + /// + /// The outgoing request + /// A token to cancel the operation + public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + if (request == null) + throw new ArgumentNullException("request"); + + request.Headers.Add("Ocp-Apim-Subscription-Key", this.subscriptionKey); + + return Task.FromResult(null); + } + } +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/BaseTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/BaseTests.cs new file mode 100644 index 000000000000..9bbb0bef98b8 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/BaseTests.cs @@ -0,0 +1,20 @@ +using Microsoft.Azure.CognitiveServices.Language.TextAnalytics; +using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models; +using System.Net.Http; + +namespace Language.Tests +{ + public abstract class BaseTests + { + public static bool IsTestTenant = false; + private static string SubscriptionKey = "000"; + + protected ITextAnalyticsAPI GetClient(DelegatingHandler handler) + { + return new TextAnalyticsAPI(new ApiKeyServiceClientCredentials(SubscriptionKey), handlers: handler) + { + AzureRegion = AzureRegions.Westus + }; + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.csproj b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.csproj new file mode 100644 index 000000000000..f92c210fbed8 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.csproj @@ -0,0 +1,31 @@ + + + + Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests Class Library + Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests + 1.0.0-preview + + + + netcoreapp1.1 + + + + + + + + + + + + + PreserveNewest + + + + + + + + diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json new file mode 100644 index 000000000000..09efd652ef69 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json @@ -0,0 +1,55 @@ +{ + "Entries": [ + { + "RequestUri": "/text/analytics/v2.0/languages", + "EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAvbGFuZ3VhZ2Vz", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "98" + ], + "Ocp-Apim-Subscription-Key": [ + "" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0" + ] + }, + "ResponseBody": "{\r\n \"documents\": [\r\n {\r\n \"id\": \"id\",\r\n \"detectedLanguages\": [\r\n {\r\n \"name\": \"English\",\r\n \"iso6391Name\": \"en\",\r\n \"score\": 1.0\r\n }\r\n ]\r\n }\r\n ],\r\n \"errors\": []\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 30 Aug 2017 02:11:18 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-ms-transaction-count": [ + "1" + ], + "x-aml-ta-request-id": [ + "473e3a1f-cf5e-4230-85b5-68fe2518370f" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "apim-request-id": [ + "69e6aeb0-e601-42ca-9468-f0cfaa408708" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains; preload" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": {} +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.EntitiesTests/Entities.json b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.EntitiesTests/Entities.json new file mode 100644 index 000000000000..6708cf4ff54c --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.EntitiesTests/Entities.json @@ -0,0 +1,55 @@ +{ + "Entries": [ + { + "RequestUri": "/text/analytics/v2.0/entities", + "EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAvZW50aXRpZXM=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"Microsoft released Windows 10\"\r\n }\r\n ]\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "123" + ], + "Ocp-Apim-Subscription-Key": [ + "" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0" + ] + }, + "ResponseBody": "{ \"documents\": [{\"id\": \"1\", \"entities\": [ { \"name\": \"Windows 10\", \"matches\": [ { \"text\": \"Windows 10\", \"offset\": 19, \"length\": 10 } ], \"wikipediaLanguage\": \"en\", \"wikipediaId\": \"Windows 10\", \"wikipediaUrl\": \"https://en.wikipedia.org/wiki/Windows_10\", \"bingId\": \"5f9fbd03-49c4-39ef-cc95-de83ab897b94\" }, { \"name\": \"Microsoft\", \"matches\": [ { \"text\": \"Microsoft\", \"offset\": 0, \"length\": 9 } ], \"wikipediaLanguage\": \"en\", \"wikipediaId\": \"Microsoft\", \"wikipediaUrl\": \"https://en.wikipedia.org/wiki/Microsoft\", \"bingId\": \"a093e9b9-90f5-a3d5-c4b8-5855e1b01f85\" } ] }\r\n ],\r\n \"errors\": []\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 30 Aug 2017 02:11:17 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-ms-transaction-count": [ + "1" + ], + "x-aml-ta-request-id": [ + "460baaca-7f57-42c1-8cc7-8852957d05b9" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "apim-request-id": [ + "3f09b1c9-fe3b-46bb-badf-98108c599825" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains; preload" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": {} +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json new file mode 100644 index 000000000000..eefb0cd06cd0 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json @@ -0,0 +1,55 @@ +{ + "Entries": [ + { + "RequestUri": "/text/analytics/v2.0/keyPhrases", + "EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAva2V5UGhyYXNlcw==", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "123" + ], + "Ocp-Apim-Subscription-Key": [ + "" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0" + ] + }, + "ResponseBody": "{\r\n \"documents\": [\r\n {\r\n \"keyPhrases\": [\r\n \"team mates\"\r\n ],\r\n \"id\": \"id\"\r\n }\r\n ],\r\n \"errors\": []\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 30 Aug 2017 02:11:17 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-ms-transaction-count": [ + "1" + ], + "x-aml-ta-request-id": [ + "460baaca-7f57-42c1-8cc7-8852957d05b9" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "apim-request-id": [ + "3f09b1c9-fe3b-46bb-badf-98108c599825" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains; preload" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": {} +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.SentimentTests/Sentiment.json b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.SentimentTests/Sentiment.json new file mode 100644 index 000000000000..c5f620b0eadf --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/SessionRecords/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.SentimentTests/Sentiment.json @@ -0,0 +1,55 @@ +{ + "Entries": [ + { + "RequestUri": "/text/analytics/v2.0/sentiment", + "EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAvc2VudGltZW50", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "123" + ], + "Ocp-Apim-Subscription-Key": [ + "" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0" + ] + }, + "ResponseBody": "{\r\n \"documents\": [\r\n {\r\n \"score\": 0.97380387783050537,\r\n \"id\": \"id\"\r\n }\r\n ],\r\n \"errors\": []\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Wed, 30 Aug 2017 02:11:17 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-ms-transaction-count": [ + "1" + ], + "x-aml-ta-request-id": [ + "06db056b-1bf0-4994-933a-f08eacf94053" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "apim-request-id": [ + "63c5b90f-3a35-48c3-bb85-d89218d1202e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains; preload" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": {} +} \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/DetectLanguageTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/DetectLanguageTests.cs new file mode 100644 index 000000000000..de923de69697 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/DetectLanguageTests.cs @@ -0,0 +1,37 @@ +using Language.Tests; + +using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + +using System.Collections.Generic; +using System.Threading.Tasks; + +using Xunit; + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests +{ + public class DetectLanguageTests : BaseTests + { + [Fact] + public async Task DetectLanguage() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + HttpMockServer.Initialize(this.GetType().FullName, "DetectLanguage"); + ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance()); + LanguageBatchResult result = await client.DetectLanguageAsync( + new BatchInput( + new List() + { + new Input("id","I love my team mates") + })); + + Assert.Equal("English", result.Documents[0].DetectedLanguages[0].Name); + Assert.Equal("en", result.Documents[0].DetectedLanguages[0].Iso6391Name); + Assert.True(result.Documents[0].DetectedLanguages[0].Score > 0.7); + context.Stop(); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/EntitiesTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/EntitiesTests.cs new file mode 100644 index 000000000000..c9fc4da20d57 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/EntitiesTests.cs @@ -0,0 +1,38 @@ +using Language.Tests; +using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests +{ + public class EntitiesTests : BaseTests + { + [Fact] + public async Task Entities() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + HttpMockServer.Initialize(this.GetType().FullName, "Entities"); + ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance()); + EntitiesBatchResult result = await client.EntitiesAsync( + new MultiLanguageBatchInput( + new List() + { + new MultiLanguageInput() + { + Id ="id", + Text ="Microsoft released Windows 10", + Language ="en" + } + })); + + Assert.Equal("Windows 10", result.Documents[0].Entities[0].Name); + Assert.Equal("5f9fbd03-49c4-39ef-cc95-de83ab897b94", result.Documents[0].Entities[0].BingId); + context.Stop(); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/KeyPhrasesTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/KeyPhrasesTests.cs new file mode 100644 index 000000000000..1c948c05c5f4 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/KeyPhrasesTests.cs @@ -0,0 +1,39 @@ +using Language.Tests; + +using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + +using System.Collections.Generic; +using System.Threading.Tasks; + +using Xunit; + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests +{ + public class KeyPhrasesTests : BaseTests + { + [Fact] + public async Task KeyPhrases() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + HttpMockServer.Initialize(this.GetType().FullName, "KeyPhrases"); + ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance()); + KeyPhraseBatchResult result = await client.KeyPhrasesAsync( + new MultiLanguageBatchInput( + new List() + { + new MultiLanguageInput() + { + Id ="id", + Text ="I love my team mates", + Language ="en" + } + })); + + Assert.Equal("team mates", result.Documents[0].KeyPhrases[0]); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/SentimentTests.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/SentimentTests.cs new file mode 100644 index 000000000000..b417373bd29c --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.Tests/TextAnalytics/SentimentTests.cs @@ -0,0 +1,39 @@ +using Language.Tests; + +using Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + +using System.Collections.Generic; +using System.Threading.Tasks; + +using Xunit; + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests +{ + public class SentimentTests : BaseTests + { + [Fact] + public async Task Sentiment() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + HttpMockServer.Initialize(this.GetType().FullName, "Sentiment"); + ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance()); + SentimentBatchResult result = await client.SentimentAsync( + new MultiLanguageBatchInput( + new List() + { + new MultiLanguageInput() + { + Id ="id", + Text ="I love my team mates", + Language ="en" + } + })); + + Assert.True(result.Documents[0].Score > 0); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.sln b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.sln new file mode 100644 index 000000000000..77d86e5dc708 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.CognitiveServices.Language.TextAnalytics", "TextAnalytics\Microsoft.Azure.CognitiveServices.Language.TextAnalytics.csproj", "{6807B854-8528-4FEE-A25D-C43C3AA2D601}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests", "TextAnalytics.Tests\Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Tests.csproj", "{5987D97A-E532-450C-BF22-A1F595C927F1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6807B854-8528-4FEE-A25D-C43C3AA2D601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6807B854-8528-4FEE-A25D-C43C3AA2D601}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6807B854-8528-4FEE-A25D-C43C3AA2D601}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6807B854-8528-4FEE-A25D-C43C3AA2D601}.Release|Any CPU.Build.0 = Release|Any CPU + {5987D97A-E532-450C-BF22-A1F595C927F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5987D97A-E532-450C-BF22-A1F595C927F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5987D97A-E532-450C-BF22-A1F595C927F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5987D97A-E532-450C-BF22-A1F595C927F1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1D51E609-34DE-4437-8198-CD6CFD13533B} + EndGlobalSection +EndGlobal diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsAPI.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsAPI.cs new file mode 100644 index 000000000000..67f9edbe15f8 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsAPI.cs @@ -0,0 +1,148 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// The Text Analytics API is a suite of text analytics web services built + /// with best-in-class Microsoft machine learning algorithms. The API can + /// be used to analyze unstructured text for tasks such as sentiment + /// analysis, key phrase extraction and language detection. No training + /// data is needed to use this API; just bring your text data. This API + /// uses advanced natural language processing techniques to deliver best in + /// class predictions. Further documentation can be found in + /// https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview + /// + public partial interface ITextAnalyticsAPI : System.IDisposable + { + /// + /// The base URI of the service. + /// + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Supported Azure regions for Cognitive Services endpoints. Possible + /// values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', + /// 'westcentralus', 'westus2', 'eastus', 'southcentralus', + /// 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth' + /// + AzureRegions AzureRegion { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// The API returns a list of strings denoting the key talking points + /// in the input text. + /// + /// + /// See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text + /// Analytics Documentation</a> for details about the languages + /// that are supported by key phrase extraction. + /// + /// + /// Collection of documents to analyze. Documents can now contain a + /// language field to indicate the text language + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> KeyPhrasesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// The API returns the detected language and a numeric score between 0 + /// and 1. + /// + /// + /// Scores close to 1 indicate 100% certainty that the identified + /// language is true. A total of 120 languages are supported. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> DetectLanguageWithHttpMessagesAsync(BatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// The API returns a numeric score between 0 and 1. + /// + /// + /// Scores close to 1 indicate positive sentiment, while scores close + /// to 0 indicate negative sentiment. A score of 0.5 indicates the lack + /// of sentiment (e.g. a factoid statement). See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text + /// Analytics Documentation</a> for details about the languages + /// that are supported by sentiment analysis. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> SentimentWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// The API returns a list of recognized entities in a given document. + /// + /// + /// To get even more information on each recognized entity we recommend + /// using the Bing Entity Search API by querying for the recognized + /// entities names. See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported + /// languages in Text Analytics API</a> for the list of enabled + /// languages. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> EntitiesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/AzureRegions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/AzureRegions.cs new file mode 100644 index 000000000000..467a08987334 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/AzureRegions.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AzureRegions. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AzureRegions + { + [EnumMember(Value = "westus")] + Westus, + [EnumMember(Value = "westeurope")] + Westeurope, + [EnumMember(Value = "southeastasia")] + Southeastasia, + [EnumMember(Value = "eastus2")] + Eastus2, + [EnumMember(Value = "westcentralus")] + Westcentralus, + [EnumMember(Value = "westus2")] + Westus2, + [EnumMember(Value = "eastus")] + Eastus, + [EnumMember(Value = "southcentralus")] + Southcentralus, + [EnumMember(Value = "northeurope")] + Northeurope, + [EnumMember(Value = "eastasia")] + Eastasia, + [EnumMember(Value = "australiaeast")] + Australiaeast, + [EnumMember(Value = "brazilsouth")] + Brazilsouth + } + internal static class AzureRegionsEnumExtension + { + internal static string ToSerializedValue(this AzureRegions? value) + { + return value == null ? null : ((AzureRegions)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AzureRegions value) + { + switch( value ) + { + case AzureRegions.Westus: + return "westus"; + case AzureRegions.Westeurope: + return "westeurope"; + case AzureRegions.Southeastasia: + return "southeastasia"; + case AzureRegions.Eastus2: + return "eastus2"; + case AzureRegions.Westcentralus: + return "westcentralus"; + case AzureRegions.Westus2: + return "westus2"; + case AzureRegions.Eastus: + return "eastus"; + case AzureRegions.Southcentralus: + return "southcentralus"; + case AzureRegions.Northeurope: + return "northeurope"; + case AzureRegions.Eastasia: + return "eastasia"; + case AzureRegions.Australiaeast: + return "australiaeast"; + case AzureRegions.Brazilsouth: + return "brazilsouth"; + } + return null; + } + + internal static AzureRegions? ParseAzureRegions(this string value) + { + switch( value ) + { + case "westus": + return AzureRegions.Westus; + case "westeurope": + return AzureRegions.Westeurope; + case "southeastasia": + return AzureRegions.Southeastasia; + case "eastus2": + return AzureRegions.Eastus2; + case "westcentralus": + return AzureRegions.Westcentralus; + case "westus2": + return AzureRegions.Westus2; + case "eastus": + return AzureRegions.Eastus; + case "southcentralus": + return AzureRegions.Southcentralus; + case "northeurope": + return AzureRegions.Northeurope; + case "eastasia": + return AzureRegions.Eastasia; + case "australiaeast": + return AzureRegions.Australiaeast; + case "brazilsouth": + return AzureRegions.Brazilsouth; + } + return null; + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs new file mode 100644 index 000000000000..3b099904d68a --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class BatchInput + { + /// + /// Initializes a new instance of the BatchInput class. + /// + public BatchInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchInput class. + /// + public BatchInput(IList documents = default(IList)) + { + Documents = documents; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "documents")] + public IList Documents { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs new file mode 100644 index 000000000000..245b396c8621 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DetectedLanguage + { + /// + /// Initializes a new instance of the DetectedLanguage class. + /// + public DetectedLanguage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DetectedLanguage class. + /// + /// Long name of a detected language (e.g. English, + /// French). + /// A two letter representation of the + /// detected language according to the ISO 639-1 standard (e.g. en, + /// fr). + /// A confidence score between 0 and 1. Scores + /// close to 1 indicate 100% certainty that the identified language is + /// true. + public DetectedLanguage(string name = default(string), string iso6391Name = default(string), double? score = default(double?)) + { + Name = name; + Iso6391Name = iso6391Name; + Score = score; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets long name of a detected language (e.g. English, + /// French). + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets a two letter representation of the detected language + /// according to the ISO 639-1 standard (e.g. en, fr). + /// + [JsonProperty(PropertyName = "iso6391Name")] + public string Iso6391Name { get; set; } + + /// + /// Gets or sets a confidence score between 0 and 1. Scores close to 1 + /// indicate 100% certainty that the identified language is true. + /// + [JsonProperty(PropertyName = "score")] + public double? Score { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs new file mode 100644 index 000000000000..70b135e11f92 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class EntitiesBatchResult + { + /// + /// Initializes a new instance of the EntitiesBatchResult class. + /// + public EntitiesBatchResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntitiesBatchResult class. + /// + public EntitiesBatchResult(IList documents = default(IList), IList errors = default(IList)) + { + Documents = documents; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "documents")] + public IList Documents { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs new file mode 100644 index 000000000000..9586ad36a830 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class EntitiesBatchResultItem + { + /// + /// Initializes a new instance of the EntitiesBatchResultItem class. + /// + public EntitiesBatchResultItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntitiesBatchResultItem class. + /// + /// Unique document identifier. + /// Recognized entities in the document. + public EntitiesBatchResultItem(string id = default(string), IList entities = default(IList)) + { + Id = id; + Entities = entities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets unique document identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets recognized entities in the document. + /// + [JsonProperty(PropertyName = "entities")] + public IList Entities { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs new file mode 100644 index 000000000000..ce2992d5db9b --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class EntityRecord + { + /// + /// Initializes a new instance of the EntityRecord class. + /// + public EntityRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityRecord class. + /// + /// Entity formal name. + /// List of instances this entity appears in the + /// text. + /// Wikipedia language for which the + /// WikipediaId and WikipediaUrl refers to. + /// Wikipedia unique identifier of the + /// recognized entity. + /// URL for the entity's English Wikipedia + /// page. + /// Bing unique identifier of the recognized + /// entity. Use in conjunction with the Bing Entity Search API to fetch + /// additional relevant information. + public EntityRecord(string name = default(string), IList matches = default(IList), string wikipediaLanguage = default(string), string wikipediaId = default(string), string wikipediaUrl = default(string), string bingId = default(string)) + { + Name = name; + Matches = matches; + WikipediaLanguage = wikipediaLanguage; + WikipediaId = wikipediaId; + WikipediaUrl = wikipediaUrl; + BingId = bingId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets entity formal name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets list of instances this entity appears in the text. + /// + [JsonProperty(PropertyName = "matches")] + public IList Matches { get; private set; } + + /// + /// Gets or sets wikipedia language for which the WikipediaId and + /// WikipediaUrl refers to. + /// + [JsonProperty(PropertyName = "wikipediaLanguage")] + public string WikipediaLanguage { get; set; } + + /// + /// Gets or sets wikipedia unique identifier of the recognized entity. + /// + [JsonProperty(PropertyName = "wikipediaId")] + public string WikipediaId { get; set; } + + /// + /// Gets URL for the entity's English Wikipedia page. + /// + [JsonProperty(PropertyName = "wikipediaUrl")] + public string WikipediaUrl { get; private set; } + + /// + /// Gets or sets bing unique identifier of the recognized entity. Use + /// in conjunction with the Bing Entity Search API to fetch additional + /// relevant information. + /// + [JsonProperty(PropertyName = "bingId")] + public string BingId { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs new file mode 100644 index 000000000000..4cd76c5c32dd --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ErrorRecord + { + /// + /// Initializes a new instance of the ErrorRecord class. + /// + public ErrorRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorRecord class. + /// + /// Input document unique identifier the error refers + /// to. + /// Error message. + public ErrorRecord(string id = default(string), string message = default(string)) + { + Id = id; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets input document unique identifier the error refers to. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs new file mode 100644 index 000000000000..a0238b4cd64b --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse(string code = default(string), string message = default(string), string target = default(string), InternalError innerError = default(InternalError)) + { + Code = code; + Message = message; + Target = target; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// + [JsonProperty(PropertyName = "innerError")] + public InternalError InnerError { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..d88dd6b74f42 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/Input.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/Input.cs new file mode 100644 index 000000000000..a73c34d36d57 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/Input.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class Input + { + /// + /// Initializes a new instance of the Input class. + /// + public Input() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Input class. + /// + /// Unique, non-empty document identifier. + public Input(string id = default(string), string text = default(string)) + { + Id = id; + Text = text; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique, non-empty document identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs new file mode 100644 index 000000000000..31497f699611 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class InternalError + { + /// + /// Initializes a new instance of the InternalError class. + /// + public InternalError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InternalError class. + /// + public InternalError(string code = default(string), string message = default(string), InternalError innerError = default(InternalError)) + { + Code = code; + Message = message; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "innerError")] + public InternalError InnerError { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs new file mode 100644 index 000000000000..663f914d9616 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class KeyPhraseBatchResult + { + /// + /// Initializes a new instance of the KeyPhraseBatchResult class. + /// + public KeyPhraseBatchResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyPhraseBatchResult class. + /// + public KeyPhraseBatchResult(IList documents = default(IList), IList errors = default(IList)) + { + Documents = documents; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "documents")] + public IList Documents { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs new file mode 100644 index 000000000000..4402ee0ff877 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class KeyPhraseBatchResultItem + { + /// + /// Initializes a new instance of the KeyPhraseBatchResultItem class. + /// + public KeyPhraseBatchResultItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyPhraseBatchResultItem class. + /// + /// A list of representative words or phrases. + /// The number of key phrases returned is proportional to the number of + /// words in the input document. + /// Unique document identifier. + public KeyPhraseBatchResultItem(IList keyPhrases = default(IList), string id = default(string)) + { + KeyPhrases = keyPhrases; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of representative words or phrases. The number of key + /// phrases returned is proportional to the number of words in the + /// input document. + /// + [JsonProperty(PropertyName = "keyPhrases")] + public IList KeyPhrases { get; private set; } + + /// + /// Gets unique document identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs new file mode 100644 index 000000000000..e28681181736 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class LanguageBatchResult + { + /// + /// Initializes a new instance of the LanguageBatchResult class. + /// + public LanguageBatchResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LanguageBatchResult class. + /// + public LanguageBatchResult(IList documents = default(IList), IList errors = default(IList)) + { + Documents = documents; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "documents")] + public IList Documents { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs new file mode 100644 index 000000000000..47beaf5afe4a --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class LanguageBatchResultItem + { + /// + /// Initializes a new instance of the LanguageBatchResultItem class. + /// + public LanguageBatchResultItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LanguageBatchResultItem class. + /// + /// Unique document identifier. + /// A list of extracted + /// languages. + public LanguageBatchResultItem(string id = default(string), IList detectedLanguages = default(IList)) + { + Id = id; + DetectedLanguages = detectedLanguages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets unique document identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets a list of extracted languages. + /// + [JsonProperty(PropertyName = "detectedLanguages")] + public IList DetectedLanguages { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs new file mode 100644 index 000000000000..65835ae26620 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class MatchRecord + { + /// + /// Initializes a new instance of the MatchRecord class. + /// + public MatchRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MatchRecord class. + /// + /// Entity text as appears in the request. + /// Start position (in Unicode characters) for the + /// entity match text. + /// Length (in Unicode characters) for the entity + /// match text. + public MatchRecord(string text = default(string), int? offset = default(int?), int? length = default(int?)) + { + Text = text; + Offset = offset; + Length = length; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets entity text as appears in the request. + /// + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + /// + /// Gets or sets start position (in Unicode characters) for the entity + /// match text. + /// + [JsonProperty(PropertyName = "offset")] + public int? Offset { get; set; } + + /// + /// Gets or sets length (in Unicode characters) for the entity match + /// text. + /// + [JsonProperty(PropertyName = "length")] + public int? Length { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs new file mode 100644 index 000000000000..717df86fef80 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class MultiLanguageBatchInput + { + /// + /// Initializes a new instance of the MultiLanguageBatchInput class. + /// + public MultiLanguageBatchInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MultiLanguageBatchInput class. + /// + public MultiLanguageBatchInput(IList documents = default(IList)) + { + Documents = documents; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "documents")] + public IList Documents { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs new file mode 100644 index 000000000000..c1fa451ecece --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class MultiLanguageInput + { + /// + /// Initializes a new instance of the MultiLanguageInput class. + /// + public MultiLanguageInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MultiLanguageInput class. + /// + /// This is the 2 letter ISO 639-1 + /// representation of a language. For example, use "en" for English; + /// "es" for Spanish etc., + /// Unique, non-empty document identifier. + public MultiLanguageInput(string language = default(string), string id = default(string), string text = default(string)) + { + Language = language; + Id = id; + Text = text; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is the 2 letter ISO 639-1 representation of a + /// language. For example, use "en" for English; "es" for Spanish etc., + /// + [JsonProperty(PropertyName = "language")] + public string Language { get; set; } + + /// + /// Gets or sets unique, non-empty document identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs new file mode 100644 index 000000000000..1b66e1cdbd4d --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class SentimentBatchResult + { + /// + /// Initializes a new instance of the SentimentBatchResult class. + /// + public SentimentBatchResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SentimentBatchResult class. + /// + public SentimentBatchResult(IList documents = default(IList), IList errors = default(IList)) + { + Documents = documents; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "documents")] + public IList Documents { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs new file mode 100644 index 000000000000..595709a09c33 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class SentimentBatchResultItem + { + /// + /// Initializes a new instance of the SentimentBatchResultItem class. + /// + public SentimentBatchResultItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SentimentBatchResultItem class. + /// + /// A decimal number between 0 and 1 denoting the + /// sentiment of the document. A score above 0.7 usually refers to a + /// positive document while a score below 0.3 normally has a negative + /// connotation. Mid values refer to neutral text. + /// Unique document identifier. + public SentimentBatchResultItem(double? score = default(double?), string id = default(string)) + { + Score = score; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a decimal number between 0 and 1 denoting the sentiment of the + /// document. A score above 0.7 usually refers to a positive document + /// while a score below 0.3 normally has a negative connotation. Mid + /// values refer to neutral text. + /// + [JsonProperty(PropertyName = "score")] + public double? Score { get; private set; } + + /// + /// Gets unique document identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsAPI.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsAPI.cs new file mode 100644 index 000000000000..5abffc11d7ba --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsAPI.cs @@ -0,0 +1,30 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_TextAnalyticsAPI + { + get + { + return new Tuple[] + { + new Tuple("TextAnalyticsAPI", "Detect Language", "v2.0"), + new Tuple("TextAnalyticsAPI", "Entities", "v2.0"), + new Tuple("TextAnalyticsAPI", "Key Phrases", "v2.0"), + new Tuple("TextAnalyticsAPI", "Sentiment", "v2.0"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsAPI.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsAPI.cs new file mode 100644 index 000000000000..18d31ff6f97f --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsAPI.cs @@ -0,0 +1,824 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// The Text Analytics API is a suite of text analytics web services built + /// with best-in-class Microsoft machine learning algorithms. The API can + /// be used to analyze unstructured text for tasks such as sentiment + /// analysis, key phrase extraction and language detection. No training + /// data is needed to use this API; just bring your text data. This API + /// uses advanced natural language processing techniques to deliver best in + /// class predictions. Further documentation can be found in + /// https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview + /// + public partial class TextAnalyticsAPI : ServiceClient, ITextAnalyticsAPI + { + /// + /// The base URI of the service. + /// + internal string BaseUri {get; set;} + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Supported Azure regions for Cognitive Services endpoints. Possible values + /// include: 'westus', 'westeurope', 'southeastasia', 'eastus2', + /// 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', + /// 'eastasia', 'australiaeast', 'brazilsouth' + /// + public AzureRegions AzureRegion { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Initializes a new instance of the TextAnalyticsAPI class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TextAnalyticsAPI(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsAPI class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TextAnalyticsAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsAPI class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public TextAnalyticsAPI(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the TextAnalyticsAPI class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public TextAnalyticsAPI(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + BaseUri = "https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics"; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + } + /// + /// The API returns a list of strings denoting the key talking points in the + /// input text. + /// + /// + /// See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text + /// Analytics Documentation</a> for details about the languages that are + /// supported by key phrase extraction. + /// + /// + /// Collection of documents to analyze. Documents can now contain a language + /// field to indicate the text language + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> KeyPhrasesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (input == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "input"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("input", input); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "KeyPhrases", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v2.0/keyPhrases"; + _url = _url.Replace("{AzureRegion}", SafeJsonConvert.SerializeObject(AzureRegion, SerializationSettings).Trim('"')); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(input != null) + { + _requestContent = SafeJsonConvert.SerializeObject(input, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The API returns the detected language and a numeric score between 0 and 1. + /// + /// + /// Scores close to 1 indicate 100% certainty that the identified language is + /// true. A total of 120 languages are supported. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DetectLanguageWithHttpMessagesAsync(BatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (input == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "input"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("input", input); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DetectLanguage", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v2.0/languages"; + _url = _url.Replace("{AzureRegion}", SafeJsonConvert.SerializeObject(AzureRegion, SerializationSettings).Trim('"')); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(input != null) + { + _requestContent = SafeJsonConvert.SerializeObject(input, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The API returns a numeric score between 0 and 1. + /// + /// + /// Scores close to 1 indicate positive sentiment, while scores close to 0 + /// indicate negative sentiment. A score of 0.5 indicates the lack of sentiment + /// (e.g. a factoid statement). See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text + /// Analytics Documentation</a> for details about the languages that are + /// supported by sentiment analysis. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> SentimentWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (input == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "input"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("input", input); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Sentiment", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v2.0/sentiment"; + _url = _url.Replace("{AzureRegion}", SafeJsonConvert.SerializeObject(AzureRegion, SerializationSettings).Trim('"')); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(input != null) + { + _requestContent = SafeJsonConvert.SerializeObject(input, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The API returns a list of recognized entities in a given document. + /// + /// + /// To get even more information on each recognized entity we recommend using + /// the Bing Entity Search API by querying for the recognized entities names. + /// See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported + /// languages in Text Analytics API</a> for the list of enabled + /// languages. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> EntitiesWithHttpMessagesAsync(MultiLanguageBatchInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (input == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "input"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("input", input); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Entities", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v2.0/entities"; + _url = _url.Replace("{AzureRegion}", SafeJsonConvert.SerializeObject(AzureRegion, SerializationSettings).Trim('"')); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(input != null) + { + _requestContent = SafeJsonConvert.SerializeObject(input, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsAPIExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsAPIExtensions.cs new file mode 100644 index 000000000000..a92827ce751a --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsAPIExtensions.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Language.TextAnalytics +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TextAnalyticsAPI. + /// + public static partial class TextAnalyticsAPIExtensions + { + /// + /// The API returns a list of strings denoting the key talking points in the + /// input text. + /// + /// + /// See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text + /// Analytics Documentation</a> for details about the languages that are + /// supported by key phrase extraction. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Collection of documents to analyze. Documents can now contain a language + /// field to indicate the text language + /// + /// + /// The cancellation token. + /// + public static async Task KeyPhrasesAsync(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.KeyPhrasesWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The API returns the detected language and a numeric score between 0 and 1. + /// + /// + /// Scores close to 1 indicate 100% certainty that the identified language is + /// true. A total of 120 languages are supported. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// The cancellation token. + /// + public static async Task DetectLanguageAsync(this ITextAnalyticsAPI operations, BatchInput input, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DetectLanguageWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The API returns a numeric score between 0 and 1. + /// + /// + /// Scores close to 1 indicate positive sentiment, while scores close to 0 + /// indicate negative sentiment. A score of 0.5 indicates the lack of sentiment + /// (e.g. a factoid statement). See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text + /// Analytics Documentation</a> for details about the languages that are + /// supported by sentiment analysis. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// The cancellation token. + /// + public static async Task SentimentAsync(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SentimentWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The API returns a list of recognized entities in a given document. + /// + /// + /// To get even more information on each recognized entity we recommend using + /// the Bing Entity Search API by querying for the recognized entities names. + /// See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported + /// languages in Text Analytics API</a> for the list of enabled + /// languages. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Collection of documents to analyze. + /// + /// + /// The cancellation token. + /// + public static async Task EntitiesAsync(this ITextAnalyticsAPI operations, MultiLanguageBatchInput input, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.EntitiesWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.csproj b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.csproj new file mode 100644 index 000000000000..ddbf81f36a43 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Microsoft.Azure.CognitiveServices.Language.TextAnalytics.csproj @@ -0,0 +1,31 @@ + + + + + + + Microsoft.Azure.CognitiveServices.Language.TextAnalytics + This client library provides access to the Microsoft Cognitive Services Language APIs. + 1.0.1-preview + Microsoft.Azure.CognitiveServices.Language.TextAnalytics + Microsoft Cognitive Services;Cognitive Services;Cognitive Services SDK;Text Analytics API;Text Analytics;REST HTTP client;netcore451511 + + + + + net452;netstandard1.4 + 1.0.1-preview + + + + + + diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Properties/AssemblyInfo.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..3155be24a467 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Reflection; +using System.Resources; + +[assembly: AssemblyTitle("Microsoft Azure Cognitive Services Language Client Library")] +[assembly: AssemblyDescription("Provides API functions for consuming Microsoft Azure Cognitive Services Language APIs.")] + +[assembly: AssemblyVersion("1.0.1.0")] +[assembly: AssemblyFileVersion("1.0.1.0")] + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Microsoft Azure .NET SDK")] +[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Readme.md b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Readme.md new file mode 100644 index 000000000000..0008bcacdeee --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Readme.md @@ -0,0 +1,17 @@ +# Microsoft Cognitive Services Language SDK for .NET + ---- + + This SDK allows you to build applications that consumes Microsoft Cognitive Services Language APIs. + + ### APIs + + For a full list of APIs under Language, please see our [list of language APIs](https://azure.microsoft.com/en-us/services/cognitive-services/?v=17.29#lang). + +### Target Frameworks: + +* .NET Framework 4.5.2 +* Netstandard 1.4, based on the NetCore framework + +## Build Instructions: + +To build this project, please follow the instructions [here](https://github.com/Azure/azure-sdk-for-net/blob/psSdkJson6/README.md). \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/generate.cmd b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/generate.cmd new file mode 100644 index 000000000000..ee0240cdbb0f --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/generate.cmd @@ -0,0 +1,7 @@ +:: +:: Microsoft Azure SDK for Net - Generate library code +:: Copyright (C) Microsoft Corporation. All Rights Reserved. +:: + +@echo off +call %~dp0..\..\..\..\..\..\..\tools\generate.cmd cognitiveservices/data-plane/TextAnalytics %* \ No newline at end of file diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/generate.ps1 b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/generate.ps1 new file mode 100644 index 000000000000..3ef5e3d40fd4 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/generate.ps1 @@ -0,0 +1,4 @@ +<# + This is a template to describe how to call the generateTool.ps1 script to generate the code using AutoRest +#> +powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File "$(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)\..\..\..\..\..\..\..\tools\generateTool.ps1" -ResourceProvider "cognitiveservices/data-plane/TextAnalytics" -PowershellInvoker \ No newline at end of file diff --git a/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt b/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt index 32a891420f50..fb30790a9454 100644 --- a/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt +++ b/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt @@ -1,10 +1,17 @@ -2017-09-19 03:39:07 UTC - +Executing AutoRest command +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/data-plane/TextAnalytics/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=E:\src\azure-sdk-for-net\tools\..\src\SDKs\ +2018-05-04 22:15:22 UTC 1) azure-rest-api-specs repository information -GitHub user: Azure -Branch: current -Commit: 3b5accd4c161e1cd315fe0468fa244d38f8dd6f6 +GitHub fork: Azure +Branch: master +Commit: 05a2275ab4aa098f93575f89d6d7876b0e4d8d89 2) AutoRest information Requested version: latest -Latest version: 1.2.2 +Bootstrapper version: C:\Users\assafi.REDMOND\AppData\Roaming\npm `-- autorest@2.0.4262 + + +Latest installed version: +.\tools\generate.ps1 was invoked by generate.ps1 + +