From d8f6d3bc17bfea4f37d4d8dedbe9d3c7a172e8eb Mon Sep 17 00:00:00 2001 From: Lakshmanan Ramu Meenal Date: Thu, 11 Oct 2018 14:39:57 -0700 Subject: [PATCH 1/3] generated new DSK for Text Analytics 2.2.0-preview --- .../TextAnalytics/ITextAnalyticsClient.cs | 146 +++ .../TextAnalytics/Models/BatchInput.cs | 48 + .../TextAnalytics/Models/DetectedLanguage.cs | 72 ++ .../Models/EntitiesBatchResult.cs | 54 ++ .../Models/EntitiesBatchResultItem.cs | 58 ++ .../TextAnalytics/Models/EntityRecord.cs | 99 ++ .../TextAnalytics/Models/ErrorRecord.cs | 57 ++ .../TextAnalytics/Models/ErrorResponse.cs | 64 ++ .../Models/ErrorResponseException.cs | 62 ++ .../Generated/TextAnalytics/Models/Input.cs | 54 ++ .../TextAnalytics/Models/InternalError.cs | 58 ++ .../Models/KeyPhraseBatchResult.cs | 54 ++ .../Models/KeyPhraseBatchResultItem.cs | 62 ++ .../Models/LanguageBatchResult.cs | 54 ++ .../Models/LanguageBatchResultItem.cs | 59 ++ .../TextAnalytics/Models/MatchRecord.cs | 68 ++ .../Models/MultiLanguageBatchInput.cs | 48 + .../Models/MultiLanguageInput.cs | 65 ++ .../Models/SentimentBatchResult.cs | 54 ++ .../Models/SentimentBatchResultItem.cs | 62 ++ .../SdkInfo_TextAnalyticsClient.cs | 30 + .../TextAnalytics/TextAnalyticsClient.cs | 878 ++++++++++++++++++ .../TextAnalyticsClientExtensions.cs | 131 +++ .../TextAnalytics/TextAnalyticsClient.cs | 40 + ...tiveServices.Language.TextAnalytics.csproj | 9 +- ...itiveservices_data-plane_TextAnalytics.txt | 19 +- 26 files changed, 2386 insertions(+), 19 deletions(-) create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/Input.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClientExtensions.cs diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs new file mode 100644 index 0000000000000..78649afe9214c --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs @@ -0,0 +1,146 @@ +// +// 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 ITextAnalyticsClient : 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 Cognitive Services endpoints (protocol and hostname, for + /// example: https://westus.api.cognitive.microsoft.com). + /// + string Endpoint { 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/Generated/TextAnalytics/Models/BatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs new file mode 100644 index 0000000000000..3b099904d68a1 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/DetectedLanguage.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs new file mode 100644 index 0000000000000..245b396c86212 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/EntitiesBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs new file mode 100644 index 0000000000000..70b135e11f929 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs new file mode 100644 index 0000000000000..9586ad36a8301 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/EntityRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs new file mode 100644 index 0000000000000..ce2992d5db9b6 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/ErrorRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs new file mode 100644 index 0000000000000..4cd76c5c32dd0 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/ErrorResponse.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..a0238b4cd64b2 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/ErrorResponseException.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..d88dd6b74f425 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/Input.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/Input.cs new file mode 100644 index 0000000000000..a73c34d36d57e --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/InternalError.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs new file mode 100644 index 0000000000000..31497f699611a --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs new file mode 100644 index 0000000000000..663f914d9616f --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs new file mode 100644 index 0000000000000..4402ee0ff8773 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/LanguageBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs new file mode 100644 index 0000000000000..e286811817363 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs new file mode 100644 index 0000000000000..47beaf5afe4a4 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/MatchRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs new file mode 100644 index 0000000000000..65835ae266201 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs new file mode 100644 index 0000000000000..717df86fef805 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/MultiLanguageInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs new file mode 100644 index 0000000000000..c1fa451ecece8 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/SentimentBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs new file mode 100644 index 0000000000000..1b66e1cdbd4dd --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs new file mode 100644 index 0000000000000..595709a09c330 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/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/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.cs new file mode 100644 index 0000000000000..51ce02bc95467 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.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_TextAnalyticsClient + { + get + { + return new Tuple[] + { + new Tuple("TextAnalyticsClient", "Detect Language", "v2.0"), + new Tuple("TextAnalyticsClient", "Entities", "v2.0"), + new Tuple("TextAnalyticsClient", "Key Phrases", "v2.0"), + new Tuple("TextAnalyticsClient", "Sentiment", "v2.0"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs new file mode 100644 index 0000000000000..10105ba5c245a --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs @@ -0,0 +1,878 @@ +// +// 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 TextAnalyticsClient : ServiceClient, ITextAnalyticsClient + { + /// + /// 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 Cognitive Services endpoints (protocol and hostname, for example: + /// https://westus.api.cognitive.microsoft.com). + /// + public string Endpoint { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient + protected TextAnalyticsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TextAnalyticsClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TextAnalyticsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsClient 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 TextAnalyticsClient(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 TextAnalyticsClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public TextAnalyticsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the TextAnalyticsClient 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 TextAnalyticsClient(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 = "{Endpoint}/text/analytics/v2.0"; + 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "keyPhrases"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "languages"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "sentiment"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "entities"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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/Generated/TextAnalytics/TextAnalyticsClientExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClientExtensions.cs new file mode 100644 index 0000000000000..0dfa5a1e32d97 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClientExtensions.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 TextAnalyticsClient. + /// + public static partial class TextAnalyticsClientExtensions + { + /// + /// 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 ITextAnalyticsClient 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 ITextAnalyticsClient 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 ITextAnalyticsClient 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 ITextAnalyticsClient 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/Generated/TextAnalytics/TextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs index 6f8823337ef75..10105ba5c245a 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs @@ -59,6 +59,19 @@ public partial class TextAnalyticsClient : ServiceClient, I /// public ServiceClientCredentials Credentials { get; private set; } + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient + protected TextAnalyticsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + /// /// Initializes a new instance of the TextAnalyticsClient class. /// @@ -109,6 +122,33 @@ public TextAnalyticsClient(ServiceClientCredentials credentials, params Delegati } } + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public TextAnalyticsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the TextAnalyticsClient class. /// 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 index 8c98882a16df9..6e1242715298e 100644 --- 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 @@ -6,17 +6,16 @@ Microsoft.Azure.CognitiveServices.Language.TextAnalytics This client library provides access to the Microsoft Cognitive Services Language APIs. - 2.1.0-preview + 2.2.0-preview Microsoft.Azure.CognitiveServices.Language.TextAnalytics Microsoft Cognitive Services;Cognitive Services;Cognitive Services SDK;Text Analytics API;Text Analytics;REST HTTP client;netcore451511 diff --git a/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt b/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt index 6e3a7da693475..3c14a2711354a 100644 --- a/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt +++ b/src/SDKs/_metadata/cognitiveservices_data-plane_TextAnalytics.txt @@ -1,20 +1,11 @@ -Installing AutoRest version: latest -AutoRest installed successfully. -Commencing code generation -Generating CSharp code -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.output-folder=E:\azure-sdk-for-net\src\SDKs\CognitiveServices\dataPlane\Language\TextAnalytics\TextAnalytics\Generated\TextAnalytics -2018-07-26 19:20:31 UTC +2018-10-11 21:34:47 UTC + 1) azure-rest-api-specs repository information -GitHub fork: Azure +GitHub user: Azure Branch: master -Commit: c39645d5399639edb6a46d7f87715640e928cd30 +Commit: 107e0490b26a7a4c51f031750e7a20103f456e07 2) AutoRest information Requested version: latest -Bootstrapper version: autorest@2.0.4282 - - +Bootstrapper version: C:\Users\laramume\AppData\Roaming\npm `-- autorest@2.0.4283 Latest installed version: - - From d85349cdc03cfd48eafd1096897aa36b0b829d02 Mon Sep 17 00:00:00 2001 From: Lakshmanan Ramu Meenal Date: Thu, 11 Oct 2018 14:48:34 -0700 Subject: [PATCH 2/3] generated new DSK for Text Analytics 2.2.0-preview --- .../TextAnalytics/ITextAnalyticsClient.cs | 146 --- .../TextAnalytics/Models/BatchInput.cs | 48 - .../TextAnalytics/Models/DetectedLanguage.cs | 72 -- .../Models/EntitiesBatchResult.cs | 54 -- .../Models/EntitiesBatchResultItem.cs | 58 -- .../TextAnalytics/Models/EntityRecord.cs | 99 -- .../TextAnalytics/Models/ErrorRecord.cs | 57 -- .../TextAnalytics/Models/ErrorResponse.cs | 64 -- .../Models/ErrorResponseException.cs | 62 -- .../Generated/TextAnalytics/Models/Input.cs | 54 -- .../TextAnalytics/Models/InternalError.cs | 58 -- .../Models/KeyPhraseBatchResult.cs | 54 -- .../Models/KeyPhraseBatchResultItem.cs | 62 -- .../Models/LanguageBatchResult.cs | 54 -- .../Models/LanguageBatchResultItem.cs | 59 -- .../TextAnalytics/Models/MatchRecord.cs | 68 -- .../Models/MultiLanguageBatchInput.cs | 48 - .../Models/MultiLanguageInput.cs | 65 -- .../Models/SentimentBatchResult.cs | 54 -- .../Models/SentimentBatchResultItem.cs | 62 -- .../SdkInfo_TextAnalyticsClient.cs | 30 - .../TextAnalytics/TextAnalyticsClient.cs | 878 ------------------ .../TextAnalyticsClientExtensions.cs | 131 --- 23 files changed, 2337 deletions(-) delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/Input.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs delete mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClientExtensions.cs diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs deleted file mode 100644 index 78649afe9214c..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/ITextAnalyticsClient.cs +++ /dev/null @@ -1,146 +0,0 @@ -// -// 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 ITextAnalyticsClient : 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 Cognitive Services endpoints (protocol and hostname, for - /// example: https://westus.api.cognitive.microsoft.com). - /// - string Endpoint { 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/Generated/TextAnalytics/Models/BatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs deleted file mode 100644 index 3b099904d68a1..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/BatchInput.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/DetectedLanguage.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs deleted file mode 100644 index 245b396c86212..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/DetectedLanguage.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/EntitiesBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs deleted file mode 100644 index 70b135e11f929..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResult.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs deleted file mode 100644 index 9586ad36a8301..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntitiesBatchResultItem.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/EntityRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs deleted file mode 100644 index ce2992d5db9b6..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/EntityRecord.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/ErrorRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs deleted file mode 100644 index 4cd76c5c32dd0..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorRecord.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/ErrorResponse.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs deleted file mode 100644 index a0238b4cd64b2..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponse.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/ErrorResponseException.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs deleted file mode 100644 index d88dd6b74f425..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/ErrorResponseException.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/Input.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/Input.cs deleted file mode 100644 index a73c34d36d57e..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/Input.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/InternalError.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs deleted file mode 100644 index 31497f699611a..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/InternalError.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs deleted file mode 100644 index 663f914d9616f..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResult.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs deleted file mode 100644 index 4402ee0ff8773..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/KeyPhraseBatchResultItem.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/LanguageBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs deleted file mode 100644 index e286811817363..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResult.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs deleted file mode 100644 index 47beaf5afe4a4..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/LanguageBatchResultItem.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/MatchRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs deleted file mode 100644 index 65835ae266201..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MatchRecord.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs deleted file mode 100644 index 717df86fef805..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageBatchInput.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/MultiLanguageInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs deleted file mode 100644 index c1fa451ecece8..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/MultiLanguageInput.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/SentimentBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs deleted file mode 100644 index 1b66e1cdbd4dd..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResult.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 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/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs deleted file mode 100644 index 595709a09c330..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/Models/SentimentBatchResultItem.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// 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/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.cs deleted file mode 100644 index 51ce02bc95467..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/SdkInfo_TextAnalyticsClient.cs +++ /dev/null @@ -1,30 +0,0 @@ - -// -// 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_TextAnalyticsClient - { - get - { - return new Tuple[] - { - new Tuple("TextAnalyticsClient", "Detect Language", "v2.0"), - new Tuple("TextAnalyticsClient", "Entities", "v2.0"), - new Tuple("TextAnalyticsClient", "Key Phrases", "v2.0"), - new Tuple("TextAnalyticsClient", "Sentiment", "v2.0"), - }.AsEnumerable(); - } - } - } -} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs deleted file mode 100644 index 10105ba5c245a..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs +++ /dev/null @@ -1,878 +0,0 @@ -// -// 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 TextAnalyticsClient : ServiceClient, ITextAnalyticsClient - { - /// - /// 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 Cognitive Services endpoints (protocol and hostname, for example: - /// https://westus.api.cognitive.microsoft.com). - /// - public string Endpoint { get; set; } - - /// - /// Subscription credentials which uniquely identify client subscription. - /// - public ServiceClientCredentials Credentials { get; private set; } - - /// - /// Initializes a new instance of the TextAnalyticsClient class. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient - protected TextAnalyticsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) - { - Initialize(); - } - - /// - /// Initializes a new instance of the TextAnalyticsClient class. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected TextAnalyticsClient(params DelegatingHandler[] handlers) : base(handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the TextAnalyticsClient class. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected TextAnalyticsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the TextAnalyticsClient 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 TextAnalyticsClient(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 TextAnalyticsClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient - /// - /// Thrown when a required parameter is null - /// - public TextAnalyticsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the TextAnalyticsClient 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 TextAnalyticsClient(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 = "{Endpoint}/text/analytics/v2.0"; - 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 (Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); - } - 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("/") ? "" : "/") + "keyPhrases"; - _url = _url.Replace("{Endpoint}", Endpoint); - // 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 (Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); - } - 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("/") ? "" : "/") + "languages"; - _url = _url.Replace("{Endpoint}", Endpoint); - // 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 (Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); - } - 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("/") ? "" : "/") + "sentiment"; - _url = _url.Replace("{Endpoint}", Endpoint); - // 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 (Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); - } - 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("/") ? "" : "/") + "entities"; - _url = _url.Replace("{Endpoint}", Endpoint); - // 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/Generated/TextAnalytics/TextAnalyticsClientExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClientExtensions.cs deleted file mode 100644 index 0dfa5a1e32d97..0000000000000 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClientExtensions.cs +++ /dev/null @@ -1,131 +0,0 @@ -// -// 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 TextAnalyticsClient. - /// - public static partial class TextAnalyticsClientExtensions - { - /// - /// 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 ITextAnalyticsClient 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 ITextAnalyticsClient 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 ITextAnalyticsClient 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 ITextAnalyticsClient operations, MultiLanguageBatchInput input, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.EntitiesWithHttpMessagesAsync(input, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} From b03afb095bb7d31f3925ad75e34ac83b4106e592 Mon Sep 17 00:00:00 2001 From: Lakshmanan Ramu Meenal Date: Thu, 11 Oct 2018 16:04:39 -0700 Subject: [PATCH 3/3] 2.1 preview sdk generated --- .../ITextAnalyticsClient.cs | 160 ++++ .../Models/BatchInput.cs | 48 + .../Models/DetectedLanguage.cs | 72 ++ .../Models/EntitiesBatchResultItemV2dot1.cs | 60 ++ .../Models/EntitiesBatchResultV2dot1.cs | 54 ++ .../Models/EntityRecordV2dot1.cs | 117 +++ .../Models/ErrorRecord.cs | 57 ++ .../Models/ErrorResponse.cs | 64 ++ .../Models/ErrorResponseException.cs | 62 ++ .../TextAnalytics-2.1-preview/Models/Input.cs | 54 ++ .../Models/InternalError.cs | 58 ++ .../Models/KeyPhraseBatchResult.cs | 54 ++ .../Models/KeyPhraseBatchResultItem.cs | 62 ++ .../Models/LanguageBatchResult.cs | 54 ++ .../Models/LanguageBatchResultItem.cs | 59 ++ .../Models/MatchRecordV2dot1.cs | 68 ++ .../Models/MultiLanguageBatchInput.cs | 48 + .../Models/MultiLanguageInput.cs | 65 ++ .../Models/SentimentBatchResult.cs | 54 ++ .../Models/SentimentBatchResultItem.cs | 62 ++ .../TextAnalyticsClient.cs | 891 ++++++++++++++++++ .../TextAnalyticsClientExtensions.cs | 144 +++ .../TextAnalytics/TextAnalyticsClient.cs | 40 - 23 files changed, 2367 insertions(+), 40 deletions(-) create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/ITextAnalyticsClient.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/BatchInput.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/DetectedLanguage.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntitiesBatchResultItemV2dot1.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntitiesBatchResultV2dot1.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntityRecordV2dot1.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/ErrorRecord.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/ErrorResponse.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/ErrorResponseException.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/Input.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/InternalError.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/KeyPhraseBatchResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/KeyPhraseBatchResultItem.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/LanguageBatchResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/LanguageBatchResultItem.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/MatchRecordV2dot1.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/MultiLanguageBatchInput.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/MultiLanguageInput.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/SentimentBatchResult.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/SentimentBatchResultItem.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/TextAnalyticsClient.cs create mode 100644 src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/TextAnalyticsClientExtensions.cs diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/ITextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/ITextAnalyticsClient.cs new file mode 100644 index 0000000000000..79606f50bfed0 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/ITextAnalyticsClient.cs @@ -0,0 +1,160 @@ +// +// 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 ITextAnalyticsClient : 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 Cognitive Services endpoints (protocol and hostname, for + /// example: https://westus.api.cognitive.microsoft.com). + /// + string Endpoint { 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. + /// + /// + /// 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 API returns a list of known entities and general + /// named entities ("Person", "Location", "Organization" etc) in a + /// given document. Known entities are returned with Wikipedia Id and + /// Wikipedia link, and also Bing Id which can be used in Bing Entity + /// Search API. General named entities are returned with entity types. + /// If a general named entity is also a known entity, then all + /// information regarding it (Wikipedia Id, Bing Id, entity type etc) + /// will be returned. See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking#supported-types-for-named-entity-recognition">Supported + /// Entity Types in Text Analytics API</a> for the list of + /// supported Entity Types. 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-2.1-preview/Models/BatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/BatchInput.cs new file mode 100644 index 0000000000000..3b099904d68a1 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/DetectedLanguage.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/DetectedLanguage.cs new file mode 100644 index 0000000000000..245b396c86212 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/EntitiesBatchResultItemV2dot1.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntitiesBatchResultItemV2dot1.cs new file mode 100644 index 0000000000000..08ad428c74d3e --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntitiesBatchResultItemV2dot1.cs @@ -0,0 +1,60 @@ +// +// 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 EntitiesBatchResultItemV2dot1 + { + /// + /// Initializes a new instance of the EntitiesBatchResultItemV2dot1 + /// class. + /// + public EntitiesBatchResultItemV2dot1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntitiesBatchResultItemV2dot1 + /// class. + /// + /// Unique document identifier. + /// Recognized entities in the document. + public EntitiesBatchResultItemV2dot1(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-2.1-preview/Models/EntitiesBatchResultV2dot1.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntitiesBatchResultV2dot1.cs new file mode 100644 index 0000000000000..639e029d8776f --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntitiesBatchResultV2dot1.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 EntitiesBatchResultV2dot1 + { + /// + /// Initializes a new instance of the EntitiesBatchResultV2dot1 class. + /// + public EntitiesBatchResultV2dot1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntitiesBatchResultV2dot1 class. + /// + public EntitiesBatchResultV2dot1(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-2.1-preview/Models/EntityRecordV2dot1.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntityRecordV2dot1.cs new file mode 100644 index 0000000000000..aed5b02a33f08 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/EntityRecordV2dot1.cs @@ -0,0 +1,117 @@ +// +// 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 EntityRecordV2dot1 + { + /// + /// Initializes a new instance of the EntityRecordV2dot1 class. + /// + public EntityRecordV2dot1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityRecordV2dot1 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. + /// Entity type from Named Entity Recognition + /// model + /// Entity sub type from Named Entity Recognition + /// model + public EntityRecordV2dot1(string name = default(string), IList matches = default(IList), string wikipediaLanguage = default(string), string wikipediaId = default(string), string wikipediaUrl = default(string), string bingId = default(string), string type = default(string), string subType = default(string)) + { + Name = name; + Matches = matches; + WikipediaLanguage = wikipediaLanguage; + WikipediaId = wikipediaId; + WikipediaUrl = wikipediaUrl; + BingId = bingId; + Type = type; + SubType = subType; + 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 or sets list of instances this entity appears in the text. + /// + [JsonProperty(PropertyName = "matches")] + public IList Matches { get; 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; } + + /// + /// Gets or sets entity type from Named Entity Recognition model + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets entity sub type from Named Entity Recognition model + /// + [JsonProperty(PropertyName = "subType")] + public string SubType { get; set; } + + } +} diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/ErrorRecord.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/ErrorRecord.cs new file mode 100644 index 0000000000000..4cd76c5c32dd0 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/ErrorResponse.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..a0238b4cd64b2 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/ErrorResponseException.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..d88dd6b74f425 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/Input.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/Input.cs new file mode 100644 index 0000000000000..a73c34d36d57e --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/InternalError.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/InternalError.cs new file mode 100644 index 0000000000000..31497f699611a --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/KeyPhraseBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/KeyPhraseBatchResult.cs new file mode 100644 index 0000000000000..663f914d9616f --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/KeyPhraseBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/KeyPhraseBatchResultItem.cs new file mode 100644 index 0000000000000..4402ee0ff8773 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/LanguageBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/LanguageBatchResult.cs new file mode 100644 index 0000000000000..e286811817363 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/LanguageBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/LanguageBatchResultItem.cs new file mode 100644 index 0000000000000..47beaf5afe4a4 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/MatchRecordV2dot1.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/MatchRecordV2dot1.cs new file mode 100644 index 0000000000000..09b8042ec446e --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/MatchRecordV2dot1.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 MatchRecordV2dot1 + { + /// + /// Initializes a new instance of the MatchRecordV2dot1 class. + /// + public MatchRecordV2dot1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MatchRecordV2dot1 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 MatchRecordV2dot1(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-2.1-preview/Models/MultiLanguageBatchInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/MultiLanguageBatchInput.cs new file mode 100644 index 0000000000000..717df86fef805 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/MultiLanguageInput.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/MultiLanguageInput.cs new file mode 100644 index 0000000000000..c1fa451ecece8 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/SentimentBatchResult.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/SentimentBatchResult.cs new file mode 100644 index 0000000000000..1b66e1cdbd4dd --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/Models/SentimentBatchResultItem.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/Models/SentimentBatchResultItem.cs new file mode 100644 index 0000000000000..595709a09c330 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/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-2.1-preview/TextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/TextAnalyticsClient.cs new file mode 100644 index 0000000000000..e74e7c0d7e2ff --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/TextAnalyticsClient.cs @@ -0,0 +1,891 @@ +// +// 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 TextAnalyticsClient : ServiceClient, ITextAnalyticsClient + { + /// + /// 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 Cognitive Services endpoints (protocol and hostname, for example: + /// https://westus.api.cognitive.microsoft.com). + /// + public string Endpoint { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient + protected TextAnalyticsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TextAnalyticsClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected TextAnalyticsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the TextAnalyticsClient 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 TextAnalyticsClient(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 TextAnalyticsClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public TextAnalyticsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the TextAnalyticsClient 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 TextAnalyticsClient(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 = "{Endpoint}/text/analytics/v2.1-preview"; + 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "keyPhrases"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "languages"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "sentiment"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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. + /// + /// + /// 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 API returns a list of known entities and general named + /// entities ("Person", "Location", "Organization" etc) in a given document. + /// Known entities are returned with Wikipedia Id and Wikipedia link, and also + /// Bing Id which can be used in Bing Entity Search API. General named entities + /// are returned with entity types. If a general named entity is also a known + /// entity, then all information regarding it (Wikipedia Id, Bing Id, entity + /// type etc) will be returned. See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking#supported-types-for-named-entity-recognition">Supported + /// Entity Types in Text Analytics API</a> for the list of supported + /// Entity Types. 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 (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Endpoint"); + } + 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("/") ? "" : "/") + "entities"; + _url = _url.Replace("{Endpoint}", Endpoint); + // 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-2.1-preview/TextAnalyticsClientExtensions.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/TextAnalyticsClientExtensions.cs new file mode 100644 index 0000000000000..1415f6b4b77d1 --- /dev/null +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics-2.1-preview/TextAnalyticsClientExtensions.cs @@ -0,0 +1,144 @@ +// +// 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 TextAnalyticsClient. + /// + public static partial class TextAnalyticsClientExtensions + { + /// + /// 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 ITextAnalyticsClient 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 ITextAnalyticsClient 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 ITextAnalyticsClient 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. + /// + /// + /// 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 API returns a list of known entities and general named + /// entities ("Person", "Location", "Organization" etc) in a given document. + /// Known entities are returned with Wikipedia Id and Wikipedia link, and also + /// Bing Id which can be used in Bing Entity Search API. General named entities + /// are returned with entity types. If a general named entity is also a known + /// entity, then all information regarding it (Wikipedia Id, Bing Id, entity + /// type etc) will be returned. See the <a + /// href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-entity-linking#supported-types-for-named-entity-recognition">Supported + /// Entity Types in Text Analytics API</a> for the list of supported + /// Entity Types. 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 ITextAnalyticsClient 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/Generated/TextAnalytics/TextAnalyticsClient.cs b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs index 10105ba5c245a..6f8823337ef75 100644 --- a/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs +++ b/src/SDKs/CognitiveServices/dataPlane/Language/TextAnalytics/TextAnalytics/Generated/TextAnalytics/TextAnalyticsClient.cs @@ -59,19 +59,6 @@ public partial class TextAnalyticsClient : ServiceClient, I /// public ServiceClientCredentials Credentials { get; private set; } - /// - /// Initializes a new instance of the TextAnalyticsClient class. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient - protected TextAnalyticsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) - { - Initialize(); - } - /// /// Initializes a new instance of the TextAnalyticsClient class. /// @@ -122,33 +109,6 @@ public TextAnalyticsClient(ServiceClientCredentials credentials, params Delegati } } - /// - /// Initializes a new instance of the TextAnalyticsClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling TextAnalyticsClient.Dispose(). False: will not dispose provided httpClient - /// - /// Thrown when a required parameter is null - /// - public TextAnalyticsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - /// /// Initializes a new instance of the TextAnalyticsClient class. ///